3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $stats = array( array( "statname" => "foo", "totalStatPower" => 4, ), array( "statname" => "bar", "totalStatPower" => 5, ), array( "statname" => "foo", "totalStatPower" => 10, ), ); function findStatTotal($name, array $stats) { return array_reduce(array_filter($stats, function($j) use ($name) { return $j["statname"] == $name; }), function( $a, $b ) { return $a + $b['totalStatPower']; }, 0)); } var_dump(findStatTotal("foo", $stats));
Output for 5.3.0 - 5.4.27
Parse error: syntax error, unexpected ')' in /in/u4VkV on line 19
Process exited with code 255.