3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[ "foo", "bar", "info", { "data": "{\"parts\":[{\"id\":1,\"serial\":\"19777\",\"type\":\"NONE\",\"key\":\"\"}]}", "vendor": "Test", "message": "Hello world" } ]'; $arr = json_decode($json, true); recurse($arr); // find json elements inside $arr, and decode function recurse(array &$arr) { foreach ($arr as $key => &$value) { if (is_array($value)) { recurse($value); } else { if (is_object(json_decode($value))) { $value = json_decode($value, true); } } } } echo '<pre>'; print_r($arr); echo '</pre>';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DIUKt
function name:  (null)
number of ops:  15
compiled vars:  !0 = $json, !1 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%5B%0A++++%22foo%22%2C%0A++++%22bar%22%2C%0A++++%22info%22%2C%0A++%7B%0A++++++%22data%22%3A+%22%7B%5C%22parts%5C%22%3A%5B%7B%5C%22id%5C%22%3A1%2C%5C%22serial%5C%22%3A%5C%2219777%5C%22%2C%5C%22type%5C%22%3A%5C%22NONE%5C%22%2C%5C%22key%5C%22%3A%5C%22%5C%22%7D%5D%7D%22%2C%0A++++%22vendor%22%3A+%22Test%22%2C%0A++++%22message%22%3A+%22Hello+world%22%0A++%7D%0A%5D'
   14     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !1, $3
   15     6        INIT_FCALL_BY_NAME                                       'recurse'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   30     9        ECHO                                                     '%3Cpre%3E'
   31    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   32    13        ECHO                                                     '%3C%2Fpre%3E'
         14      > RETURN                                                   1

Function recurse:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 21
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/DIUKt
function name:  recurse
number of ops:  23
compiled vars:  !0 = $arr, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1      > FE_RESET_RW                                      $3      !0, ->21
          2    > > FE_FETCH_RW                                      ~4      $3, !1, ->21
          3    >   ASSIGN                                                   !2, ~4
   20     4        TYPE_CHECK                                  128          !1
          5      > JMPZ                                                     ~6, ->10
   21     6    >   INIT_FCALL_BY_NAME                                       'recurse'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   20     9      > JMP                                                      ->20
   23    10    >   INIT_FCALL                                               'json_decode'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                         $8      
         13        TYPE_CHECK                                  256          $8
         14      > JMPZ                                                     ~9, ->20
   24    15    >   INIT_FCALL                                               'json_decode'
         16        SEND_VAR                                                 !1
         17        SEND_VAL                                                 <true>
         18        DO_ICALL                                         $10     
         19        ASSIGN                                                   !1, $10
   19    20    > > JMP                                                      ->2
         21    >   FE_FREE                                                  $3
   28    22      > RETURN                                                   null

End of function recurse

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.33 ms | 1004 KiB | 15 Q