3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = '{"uuid":"8888888888888","templateUuid":"001","trashed":"N","createdAt":"2018-09-05T07:52:37Z","updatedAt":"2019-01-24T18:45:35Z","changerUuid":"HHHHHHHHHHHHHH","itemVersion":7,"vaultUuid":"VVVVVVVVVVVVVVVVV","details":{"fields":[{"designation":"username","name":"username","type":"T","value":"33333333333333333333333333"},{"designation":"password","name":"password","type":"P","value":"9999999999999999999999999"}],"notesPlain":"aa","sections":[{"fields":[{"k":"concealed","n":"fffffffffffffffff","t":"custom","v":"something"}],"name":"Section_acydazbajjhifgnahiej3wdrxi","title":""}]},"overview":{"URLs":[{"l":"website","u":"https://api.example.com/"}],"ainfo":"33453ff2e19203cacb35dac4b304f4d3e69020a8","pbe":0,"pgrng":false,"ps":100,"tags":[],"title":"EXAMPLE API KEY","url":"https://api.example.com/"}}'; //echo print_r(json_decode($array, true), true); function findPath($array, $targetKey, $targetValue, $path = []) : ? string { if (!is_array($array)) { $array = json_decode($array, true); } foreach ($array as $key => $value) { if ($key === $targetKey && $value === $targetValue) { $path[] = $key; return implode('.', $path); } } foreach ($array as $key => $value) { if (is_array($value)) { $path[] = $key; if (($result = findPath($value, $targetKey, $targetValue, $path)) !== null) { return $result; } else { array_pop($path); } } } return null; } echo print_r(findPath($array, 'url', 'https://api.example.com/'), true);
Output for git.master, git.master_jit, rfc.property-hooks
overview.url

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