3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function testAnonFunc() { $testArray = array(1 => 'one', 2 => 'two', 3 => 'three'); $result = array_map( function ($x, $y) { $x = $x + 1; return $x; }, $testArray ); return $result; } } $a = new A(); print_r($a->testAnonFunc());

preferences:
38.95 ms | 402 KiB | 5 Q