3v4l.org

run code in 300+ PHP versions simultaneously
<?php $homepage = array(); $homepage[] = '{ "info": { "collection": [ { "Name": "Charlie", "ID": "7" }, { "Name": "Emma", "ID": "9" }, { "Name": "Laura", "ID": "11" } ] } }'; $homepage[] = '{ "info": { "collection": [ { "Name": "Jim", "ID": "12" }, { "Name": "Sam", "ID": "56" }, { "Name": "Bob", "ID": "5" } ] } }'; foreach ($homepage as $homepage2) { $data = json_decode($homepage2, false); usort($data->info->collection, function ($a, $b) { return $b->ID - $a->ID; }); foreach($data->info->collection as $key) { echo' '.$key->ID.' '.$key->Name.' '; } } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 33
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 33
Branch analysis from position: 7
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 31
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 31
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 31
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 31
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/Ot9FP
function name:  (null)
number of ops:  35
compiled vars:  !0 = $homepage, !1 = $homepage2, !2 = $data, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN_DIM                                               !0
          2        OP_DATA                                                  '%7B%0A++%22info%22%3A+%7B%0A++++%22collection%22%3A+%5B%0A++++++%7B%0A++++++++%22Name%22%3A+%22Charlie%22%2C%0A++++++++%22ID%22%3A+%227%22%0A++++++%7D%2C%0A++++++%7B%0A++++++++%22Name%22%3A+%22Emma%22%2C%0A++++++++%22ID%22%3A+%229%22%0A++++++%7D%2C%0A++++++%7B%0A++++++++%22Name%22%3A+%22Laura%22%2C%0A++++++++%22ID%22%3A+%2211%22%0A++++++%7D%0A++++%5D%0A++%7D%0A%7D'
   21     3        ASSIGN_DIM                                               !0
          4        OP_DATA                                                  '%7B%0A++%22info%22%3A+%7B%0A++++%22collection%22%3A+%5B%0A++++++%7B%0A++++++++%22Name%22%3A+%22Jim%22%2C%0A++++++++%22ID%22%3A+%2212%22%0A++++++%7D%2C%0A++++++%7B%0A++++++++%22Name%22%3A+%22Sam%22%2C%0A++++++++%22ID%22%3A+%2256%22%0A++++++%7D%2C%0A++++++%7B%0A++++++++%22Name%22%3A+%22Bob%22%2C%0A++++++++%22ID%22%3A+%225%22%0A++++++%7D%0A++++%5D%0A++%7D%0A%7D'
   40     5      > FE_RESET_R                                       $7      !0, ->33
          6    > > FE_FETCH_R                                               $7, !1, ->33
   41     7    >   INIT_FCALL                                               'json_decode'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <false>
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !2, $8
   43    12        INIT_FCALL                                               'usort'
         13        FETCH_OBJ_W                                      $10     !2, 'info'
         14        FETCH_OBJ_W                                      $11     $10, 'collection'
         15        SEND_REF                                                 $11
         16        DECLARE_LAMBDA_FUNCTION                          ~12     [0]
   45    17        SEND_VAL                                                 ~12
   43    18        DO_ICALL                                                 
   47    19        FETCH_OBJ_R                                      ~14     !2, 'info'
         20        FETCH_OBJ_R                                      ~15     ~14, 'collection'
         21      > FE_RESET_R                                       $16     ~15, ->31
         22    > > FE_FETCH_R                                               $16, !3, ->31
   49    23    >   FETCH_OBJ_R                                      ~17     !3, 'ID'
         24        CONCAT                                           ~18     '%0A++++', ~17
         25        CONCAT                                           ~19     ~18, '%0A++++'
   50    26        FETCH_OBJ_R                                      ~20     !3, 'Name'
         27        CONCAT                                           ~21     ~19, ~20
         28        CONCAT                                           ~22     ~21, '%0A++++'
         29        ECHO                                                     ~22
   47    30      > JMP                                                      ->22
         31    >   FE_FREE                                                  $16
   40    32      > JMP                                                      ->6
         33    >   FE_FREE                                                  $7
   54    34      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Ot9FP
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   44     2        FETCH_OBJ_R                                      ~2      !1, 'ID'
          3        FETCH_OBJ_R                                      ~3      !0, 'ID'
          4        SUB                                              ~4      ~2, ~3
          5      > RETURN                                                   ~4
   45     6*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.66 ms | 1006 KiB | 15 Q