3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( 'root_trrreeee1' => array( 'path1' => array( 'description' => 'etc', 'child_of_path_1' => array( array('name' => '1'), array('name' => '1') ) ), 'path2' => array( 'description' => 'etc', 'child_of_path_2' => array( array('name' => '1'), array('name' => '2') ) ), ), 'name' => '1', 1 => array('name' => '1'), 'another_leaf' => '1' ); function array_value_path(array $array, $needle, &$path) { foreach($array as $key => $value) { if ($value == $needle || is_array($value) && array_value_path($value, $needle, $path)) { array_unshift($path, $key); return true; } } return false; } $path = []; array_value_path($a, ['name' => 1], $path); print_r($path);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => root_trrreeee1 [1] => path1 [2] => child_of_path_1 [3] => 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:
132.32 ms | 405 KiB | 5 Q