3v4l.org

run code in 300+ PHP versions simultaneously
<?php function o($num) { return (object) array('num' => $num); } $arr = array( 14 => array('x' => o(1), 'oele' => array(o(1), o(2), o(3), o(4))), 91 => array('x' => o(1), 'oele' => array(o(9), o(8), o(7), o(6))), ); foreach ( $arr as $i => &$session ) { $session['boele']['one'] = 4; // works $session['boele']['two'] = array_reduce($session['oele'], function($sum, $app) use ($session) { return $sum + $app->num * $session['x']->y; }, 0); // don't works unset($session); } print_r($arr);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Warning: Undefined property: stdClass::$y in /in/jm5kc on line 15 Array ( [14] => Array ( [x] => stdClass Object ( [num] => 1 ) [oele] => Array ( [0] => stdClass Object ( [num] => 1 ) [1] => stdClass Object ( [num] => 2 ) [2] => stdClass Object ( [num] => 3 ) [3] => stdClass Object ( [num] => 4 ) ) [boele] => Array ( [one] => 4 [two] => 0 ) ) [91] => Array ( [x] => stdClass Object ( [num] => 1 ) [oele] => Array ( [0] => stdClass Object ( [num] => 9 ) [1] => stdClass Object ( [num] => 8 ) [2] => stdClass Object ( [num] => 7 ) [3] => stdClass Object ( [num] => 6 ) ) [boele] => Array ( [one] => 4 [two] => 0 ) ) )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.23 ms | 409 KiB | 8 Q