3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = file_get_contents('https://my.tradebuilders.com.au/Ajax/Members/?GetSupplierInfo=Yes'); $array = json_decode($json, true); $array = array_filter($array, function (array $values) { return recursive_assoc_in_array($values, ['S' => 6026]); }); print_r($json); function recursive_assoc_in_array(array $haystack, array $needle, $childKey = 'ChildCats') { if (array_intersect_assoc($haystack, $needle)) { return true; } if (!isset($haystack[$childKey]) || !is_array($haystack[$childKey])) { return false; } foreach ($haystack[$childKey] as $child) { if (recursive_assoc_in_array($child, $needle, $childkey)) { return true; } } return false; }

preferences:
36.29 ms | 402 KiB | 5 Q