3v4l.org

run code in 500+ PHP versions simultaneously
<?php $str = '{ "1": { "name": "test", "followup": { "1": { "id": "98", "followup": { "1": { "id": "93", "followup": { "1": { "id": "174" } } } } } } } }'; $ids = array(); $data = json_decode($str, true); array_walk_recursive($data, function($v, $k) use (&$ids) { if ($k === 'id') { $ids[] = $v; } }); var_dump($ids);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DrEdM
function name:  (null)
number of ops:  17
compiled vars:  !0 = $str, !1 = $ids, !2 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, '%7B%0A%09%221%22%3A+%7B%0A%09%09%22name%22%3A+%22test%22%2C%0A%09%09%22followup%22%3A+%7B%0A%09%09%09%221%22%3A+%7B%0A%09%09%09%09%22id%22%3A+%2298%22%2C%0A%09%09%09%09%22followup%22%3A+%7B%0A%09%09%09%09%09%221%22%3A+%7B%0A%09%09%09%09%09%09%22id%22%3A+%2293%22%2C%0A%09%09%09%09%09%09%22followup%22%3A+%7B%0A%09%09%09%09%09%09%09%221%22%3A+%7B%0A%09%09%09%09%09%09%09%09%22id%22%3A+%22174%22%0A%09%09%09%09%09%09%09%7D%0A%09%09%09%09%09%09%7D%0A%09%09%09%09%09%7D%0A%09%09%09%09%7D%0A%09%09%09%7D%0A%09%09%7D%0A%09%7D%0A%7D'
   24     1        ASSIGN                                                       !1, <array>
   25     2        INIT_FCALL                                                   'json_decode'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     <true>
          5        DO_ICALL                                             $5      
          6        ASSIGN                                                       !2, $5
   27     7        INIT_FCALL                                                   'array_walk_recursive'
          8        SEND_REF                                                     !2
          9        DECLARE_LAMBDA_FUNCTION                              ~7      [0]
         10        BIND_LEXICAL                                                 ~7, !1
   31    11        SEND_VAL                                                     ~7
   27    12        DO_ICALL                                                     
   33    13        INIT_FCALL                                                   'var_dump'
         14        SEND_VAR                                                     !1
         15        DO_ICALL                                                     
         16      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/DrEdM
function name:  {closure:/in/DrEdM:27}
number of ops:  8
compiled vars:  !0 = $v, !1 = $k, !2 = $ids
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   28     3        IS_IDENTICAL                                                 !1, 'id'
          4      > JMPZ                                                         ~3, ->7
   29     5    >   ASSIGN_DIM                                                   !2
          6        OP_DATA                                                      !0
   31     7    > > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.45 ms | 2556 KiB | 16 Q