3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'vehicle info' => [ 'one' => [ 'submodel' => 'LX', 'engine' => 2.3 ], 'two' => [ 'color' => 'blue', 'year' => 2007, 'wheels' => 4 ], 'three' => [ 'submodel' => 'LX', 'make' => 'Ford', 'model' => 'F-150', 'offroad' => 'No' ] ] ]; $needles = ['submodel', 'offroad']; $result = []; array_walk_recursive( $array, function($value, $key) use ($needles, &$result) { if ( in_array($key, $needles) && !isset($result[$key]) ) { $result[$key] = "$key is $value"; } } ); var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 'submodel' => 'submodel is LX', 'offroad' => 'offroad is No', )

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:
106.51 ms | 405 KiB | 5 Q