3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ [ 'id' => 2, 'position' => 2, ], [ 'id' => 1, 'position' => 1, ], [ 'id' => 1, 'position' => 0, ], [ 'id' => 2, 'position' => 1, ], [ 'id' => 2, 'position' => 0, ], [ 'id' => 1, 'position' => 2, ], ]; usort( $data, function ($a, $b) { if ($a['position'] == $b['position']) { return 0; } return ($a['position'] < $b['position']) ? -1 : 1; } ); usort( $data, function ($a, $b) { if ($a['id'] == $b['id']) { return 0; } return ($a['id'] < $b['id']) ? -1 : 1; } ); var_dump($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oGSdd
function name:  (null)
number of ops:  15
compiled vars:  !0 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   30     1        INIT_FCALL                                               'usort'
   31     2        SEND_REF                                                 !0
   32     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FoGSdd%3A32%240'
   38     4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   41     6        INIT_FCALL                                               'usort'
   42     7        SEND_REF                                                 !0
   43     8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FoGSdd%3A43%241'
   49     9        SEND_VAL                                                 ~4
         10        DO_ICALL                                                 
   52    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FoGSdd%3A32%240:
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/oGSdd
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        FETCH_DIM_R                                      ~2      !0, 'position'
          3        FETCH_DIM_R                                      ~3      !1, 'position'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->7
   34     6    > > RETURN                                                   0
   37     7    >   FETCH_DIM_R                                      ~5      !0, 'position'
          8        FETCH_DIM_R                                      ~6      !1, 'position'
          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
   38    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FoGSdd%3A32%240

Function %00%7Bclosure%7D%2Fin%2FoGSdd%3A43%241:
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/oGSdd
function name:  {closure}
number of ops:  16
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_DIM_R                                      ~2      !0, 'id'
          3        FETCH_DIM_R                                      ~3      !1, 'id'
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->7
   45     6    > > RETURN                                                   0
   48     7    >   FETCH_DIM_R                                      ~5      !0, 'id'
          8        FETCH_DIM_R                                      ~6      !1, 'id'
          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
   49    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FoGSdd%3A43%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.99 ms | 1400 KiB | 17 Q