eval.in

Paste #111210

PHP — PHP 5.4.6, pasted 1 year ago

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
<?php

$myTests = array( "correct", "horse", "battery", "staple" );

foreach($myTests as &$test)
{
  echo "first $test\n";
}

foreach($myTests as $test)
{
  echo "second $test\n";
}

Program Output

first correct
first horse
first battery
first staple
second correct
second horse
second battery
second battery

OK (0.008 sec real, 0.006 sec wall, 13 MB, 49 syscalls)

Fork