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 git.master, git.master_jit, rfc.property-hooks
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 ( ) ) )

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:
119.97 ms | 411 KiB | 5 Q