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; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YOfve
function name:  (null)
number of ops:  16
compiled vars:  !0 = $json, !1 = $debug, !2 = $arr, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7B%0A+++%22result%22%3A%7B%0A++++++%22Plaintiff%22%3A%7B%0A+++++++++%222015%22%3A%7B%0A++++++++++++%22SolutionsPerv%22%3A%7B%0A+++++++++++++++%22To+leave+the+decision+%28determination%29+of+the+court+of+first+instance+and+the+ruling+of+the+court+of+appeal+unchanged%2C+and+the+cassation+appeal+-+unsatisfied%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A0%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22DecisionsApp%22%3A%7B%0A+++++++++++++++%22To+leave+the+decision+%28determination%29+of+the+court+of+first+instance+and+the+ruling+of+the+court+of+appeal+unchanged%2C+and+the+cassation+appeal+-+unsatisfied%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A0%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22ResheniyaKass%22%3A%7B%0A+++++++++++++++%22To+leave+the+decision+%28determination%29+of+the+court+of+first+instance+and+the+ruling+of+the+court+of+appeal+unchanged%2C+and+the+cassation+appeal+-+unsatisfied%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A0%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22ResheniyaNadz%22%3A%5B%0A+++++++++++++++%0A++++++++++++%5D%0A+++++++++%7D%0A++++++%7D%2C%0A++++++%22Respondent%22%3A%7B%0A+++++++++%222018%22%3A%7B%0A++++++++++++%22SolutionsPerv%22%3A%7B%0A+++++++++++++++%22Leave+the+ruling+of+the+court+of+first+instance+and+the+ruling+of+the+court+of+appeal+unchanged%2C+the+cassation+appeal+without+satisfaction%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A24000%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22ResheniyaKass%22%3A%7B%0A+++++++++++++++%22Leave+the+ruling+of+the+court+of+first+instance+and+the+ruling+of+the+court+of+appeal+unchanged%2C+the+cassation+appeal+without+satisfaction%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A24000%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22ResheniyaNadz%22%3A%5B%0A+++++++++++++++%0A++++++++++++%5D%0A+++++++++%7D%2C%0A+++++++++%222019%22%3A%7B%0A++++++++++++%22ResheniyaKass%22%3A%7B%0A+++++++++++++++%22To+leave+the+decision+%28determination%29+of+the+court+of+first+instance+and+the+ruling+of+the+court+of+appeal+unchanged%2C+and+the+cassation+appeal+-+unsatisfied%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A0%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22ResheniyaNadz%22%3A%5B%0A+++++++++++++++%0A++++++++++++%5D%0A+++++++++%7D%2C%0A+++++++++%222020%22%3A%7B%0A++++++++++++%22SolutionsPerv%22%3A%7B%0A+++++++++++++++%22There+is+no+decision%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A0%2C%0A++++++++++++++++++%22Quantity%22%3A2%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22DecisionsApp%22%3A%5B%0A+++++++++++++++%0A++++++++++++%5D%0A+++++++++%7D%0A++++++%7D%2C%0A++++++%22Third+Person%22%3A%7B%0A+++++++++%222015%22%3A%7B%0A++++++++++++%22SolutionsPerv%22%3A%7B%0A+++++++++++++++%22To+leave+unchanged+the+decision+and+%28or%29+the+decision+of+the+appellate+instance%2C+and+the+cassation+appeal+-+without+satisfaction+%28clause+1+of+part+1+of+article+287+of+the+APC%29%22%3A%7B%0A++++++++++++++++++%22Amount%22%3A0%2C%0A++++++++++++++++++%22Quantity%22%3A1%0A+++++++++++++++%7D%0A++++++++++++%7D%2C%0A++++++++++++%22ResheniyaNadz%22%3A%5B%0A+++++++++++++++%0A++++++++++++%5D%0A+++++++++%7D%0A++++++%7D%0A+++%7D%0A%7D'
   85     1        ASSIGN                                                   !1, <true>
   86     2        INIT_FCALL                                               'json_decode'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 <true>
          5        DO_ICALL                                         $6      
          6        ASSIGN                                                   !2, $6
   87     7        INIT_FCALL_BY_NAME                                       'getArray'
          8        SEND_VAR_EX                                              !2
          9        SEND_VAL_EX                                              'Respondent'
         10        DO_FCALL                                      0  $8      
         11        ASSIGN                                                   !3, $8
   89    12        INIT_FCALL                                               'print_r'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                                 
   99    15      > RETURN                                                   1

Function getarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 24
Branch analysis from position: 5
2 jumps found. (Code = 46) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 23
Branch analysis from position: 10
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/YOfve
function name:  getArray
number of ops:  29
compiled vars:  !0 = $arr, !1 = $id, !2 = $store, !3 = $value, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   91     0  E >   RECV_INIT                                        !0      <array>
          1        RECV_INIT                                        !1      ''
          2        RECV_INIT                                        !2      <array>
   93     3      > FE_RESET_R                                       $5      !0, ->24
          4    > > FE_FETCH_R                                       ~6      $5, !3, ->24
          5    >   ASSIGN                                                   !4, ~6
   94     6        IS_IDENTICAL                                     ~8      !4, !1
          7      > JMPZ_EX                                          ~8      ~8, ->10
          8    >   TYPE_CHECK                                  128  ~9      !3
          9        BOOL                                             ~8      ~9
         10    > > JMPZ                                                     ~8, ->16
   95    11    >   ASSIGN                                           ~10     !2, !3
         12        VERIFY_RETURN_TYPE                                       ~10
         13        FE_FREE                                                  $5
         14      > RETURN                                                   ~10
   94    15*       JMP                                                      ->23
   96    16    >   TYPE_CHECK                                  128          !3
         17      > JMPZ                                                     ~11, ->23
         18    >   INIT_FCALL_BY_NAME                                       'getArray'
         19        SEND_VAR_EX                                              !3
         20        SEND_VAR_EX                                              !1
         21        SEND_VAR_EX                                              !2
         22        DO_FCALL                                      0          
   93    23    > > JMP                                                      ->4
         24    >   FE_FREE                                                  $5
   98    25        VERIFY_RETURN_TYPE                                       !2
         26      > RETURN                                                   !2
   99    27*       VERIFY_RETURN_TYPE                                       
         28*     > RETURN                                                   null

End of function getarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.67 ms | 1010 KiB | 15 Q