3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '{ "result":{ "Plaintiff":{ "2015":{ "SolutionsPerv":{ "To leave the decision (determination) of the court of first instance and the ruling of the court of appeal unchanged, and the cassation appeal - unsatisfied":{ "Amount":0, "Quantity":1 } }, "DecisionsApp":{ "To leave the decision (determination) of the court of first instance and the ruling of the court of appeal unchanged, and the cassation appeal - unsatisfied":{ "Amount":0, "Quantity":1 } }, "ResheniyaKass":{ "To leave the decision (determination) of the court of first instance and the ruling of the court of appeal unchanged, and the cassation appeal - unsatisfied":{ "Amount":0, "Quantity":1 } }, "ResheniyaNadz":[ ] } }, "Respondent":{ "2018":{ "SolutionsPerv":{ "Leave the ruling of the court of first instance and the ruling of the court of appeal unchanged, the cassation appeal without satisfaction":{ "Amount":24000, "Quantity":1 } }, "ResheniyaKass":{ "Leave the ruling of the court of first instance and the ruling of the court of appeal unchanged, the cassation appeal without satisfaction":{ "Amount":24000, "Quantity":1 } }, "ResheniyaNadz":[ ] }, "2019":{ "ResheniyaKass":{ "To leave the decision (determination) of the court of first instance and the ruling of the court of appeal unchanged, and the cassation appeal - unsatisfied":{ "Amount":0, "Quantity":1 } }, "ResheniyaNadz":[ ] }, "2020":{ "SolutionsPerv":{ "There is no decision":{ "Amount":0, "Quantity":2 } }, "DecisionsApp":[ ] } }, "Third Person":{ "2015":{ "SolutionsPerv":{ "To leave unchanged the decision and (or) the decision of the appellate instance, and the cassation appeal - without satisfaction (clause 1 of part 1 of article 287 of the APC)":{ "Amount":0, "Quantity":1 } }, "ResheniyaNadz":[ ] } } } }'; $debug = true; $arr = json_decode($json, true); $result = getArray($arr, 'Respondent'); // use e.g. Plaintiff or Respondent as $id print_r($result); function getArray(array $arr = [], string $id = '', &$store = []): array { foreach ($arr as $key => $value) { if ($key === $id && is_array($value)) { // identifier found return $store = $value; // store result array } elseif (is_array($value)) getArray($value, $id, $store); // keep digging } return $store; }
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.4, 8.3.6 - 8.3.26, 8.4.1 - 8.4.13
Array ( [2018] => Array ( [SolutionsPerv] => Array ( [Leave the ruling of the court of first instance and the ruling of the court of appeal unchanged, the cassation appeal without satisfaction] => Array ( [Amount] => 24000 [Quantity] => 1 ) ) [ResheniyaKass] => Array ( [Leave the ruling of the court of first instance and the ruling of the court of appeal unchanged, the cassation appeal without satisfaction] => Array ( [Amount] => 24000 [Quantity] => 1 ) ) [ResheniyaNadz] => Array ( ) ) [2019] => Array ( [ResheniyaKass] => Array ( [To leave the decision (determination) of the court of first instance and the ruling of the court of appeal unchanged, and the cassation appeal - unsatisfied] => Array ( [Amount] => 0 [Quantity] => 1 ) ) [ResheniyaNadz] => Array ( ) ) [2020] => Array ( [SolutionsPerv] => Array ( [There is no decision] => Array ( [Amount] => 0 [Quantity] => 2 ) ) [DecisionsApp] => Array ( ) ) )
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0 Array ( [2018] => Array ( [SolutionsPerv] => Array ( [Leave the ruling of the court of first instance and the ruling of the court of appeal unchanged, the cassation appeal without satisfaction] => Array ( [Amount] => 24000 [Quantity] => 1 ) ) [ResheniyaKass] => Array ( [Leave the ruling of the court of first instance and the ruling of the court of appeal unchanged, the cassation appeal without satisfaction] => Array ( [Amount] => 24000 [Quantity] => 1 ) ) [ResheniyaNadz] => Array ( ) ) [2019] => Array ( [ResheniyaKass] => Array ( [To leave the decision (determination) of the court of first instance and the ruling of the court of appeal unchanged, and the cassation appeal - unsatisfied] => Array ( [Amount] => 0 [Quantity] => 1 ) ) [ResheniyaNadz] => Array ( ) ) [2020] => Array ( [SolutionsPerv] => Array ( [There is no decision] => Array ( [Amount] => 0 [Quantity] => 2 ) ) [DecisionsApp] => Array ( ) ) )

preferences:
146.6 ms | 419 KiB | 5 Q