3v4l.org

run code in 300+ PHP versions simultaneously
<?php $class = new stdClass; $class->properties = [new stdClass,new stdClass, new stdClass]; $class->properties[0]->name = "Anne"; $class->properties[1]->name = "Bob"; $class->properties[2]->name = "Robin"; $fieldsA = []; $fieldsB = []; if ( array_walk( $class->properties, function( $o ) use ( &$fieldsA ){ $fieldsA[] = $o->name; }) ) { echo "\nMission accomplished:\n"; var_dump($fieldsA); } $fieldsB = array_map( function( $e ) { return $e->name; },$class->properties); if (count($fieldsB) > 0) { echo "\nMission accomplished:\n"; var_dump( $fieldsB ); }
Output for git.master, git.master_jit, rfc.property-hooks
Mission accomplished: array(3) { [0]=> string(4) "Anne" [1]=> string(3) "Bob" [2]=> string(5) "Robin" } Mission accomplished: array(3) { [0]=> string(4) "Anne" [1]=> string(3) "Bob" [2]=> string(5) "Robin" }

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:
48.68 ms | 401 KiB | 8 Q