3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function ScoreWords($Value){ $WordList = array( "Amazing" => 1, "Value" => 300, "Elements" => 30, "Another" => 0 ); if (array_key_exists($Value,$WordList)){ return $WordList[$Value]; } } $array = array("Value","Another",1,2,3,4); echo implode(',', $array), PHP_EOL; //foreach ($array as &$value) { // ScoreWords($value); //} //echo implode(',', $array), PHP_EOL; foreach ($array as $value) { ScoreWords($value); } echo implode(',', $array), PHP_EOL;
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Value,Another,1,2,3,4 Value,Another,1,2,3,4
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Value,Another,1,2,3,4 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/PeEGS on line 19 PHP_EOLValue,Another,1,2,3,4 Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/PeEGS on line 29 PHP_EOL