3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sortByTime($a, $b) { if ($a->time == $b->time) { return 0; } return ($a->time < $b->time) ? -1 : 1; } $a = json_decode('[{"id": 111,"time": 123123123,"data": "testc"},{ "id":200 ,"time":433123123,"data":"testb"},{"id":300,"time":33123123,"data":"testb"}]'); usort($a, "sortByTime"); print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JvAT5
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%7B%22id%22%3A+111%2C%22time%22%3A+123123123%2C%22data%22%3A+%22testc%22%7D%2C%7B+%22id%22%3A200+%2C%22time%22%3A433123123%2C%22data%22%3A%22testb%22%7D%2C%7B%22id%22%3A300%2C%22time%22%3A33123123%2C%22data%22%3A%22testb%22%7D%5D'
          2        DO_ICALL                                         $1      
          3        ASSIGN                                                   !0, $1
   13     4        INIT_FCALL                                               'usort'
          5        SEND_REF                                                 !0
          6        SEND_VAL                                                 'sortByTime'
          7        DO_ICALL                                                 
   14     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function sortbytime:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 7
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JvAT5
function name:  sortByTime
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        FETCH_OBJ_R                                      ~2      !0, 'time'
          3        FETCH_OBJ_R                                      ~3      !1, 'time'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->7
    6     6    > > RETURN                                                   0
    8     7    >   FETCH_OBJ_R                                      ~5      !0, 'time'
          8        FETCH_OBJ_R                                      ~6      !1, 'time'
          9        IS_SMALLER                                               ~5, ~6
         10      > JMPZ                                                     ~7, ->13
         11    >   QM_ASSIGN                                        ~8      -1
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~8      1
         14    > > RETURN                                                   ~8
    9    15*     > RETURN                                                   null

End of function sortbytime

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.34 ms | 1001 KiB | 16 Q