3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo($a, $b) { return $a[0] <=> $b[0] ?: $a[1] <=> $b[1] ?: $a[2] <=> $b[2] ?: 0; } $array = [ [1, 2, 3], [1, 3, 5], [1, 2, 4], [0, 2, 3], ]; usort($array, foo(...)); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8C5Xd
function name:  (null)
number of ops:  11
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                       !0, <array>
   19     1        INIT_FCALL                                                   'usort'
          2        SEND_REF                                                     !0
          3        INIT_FCALL                                                   'foo'
          4        CALLABLE_CONVERT                                     ~2      
          5        SEND_VAL                                                     ~2
          6        DO_ICALL                                                     
   20     7        INIT_FCALL                                                   'print_r'
          8        SEND_VAR                                                     !0
          9        DO_ICALL                                                     
         10      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8C5Xd
function name:  foo
number of ops:  19
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    5     2        FETCH_DIM_R                                          ~2      !0, 0
          3        FETCH_DIM_R                                          ~3      !1, 0
          4        SPACESHIP                                            ~4      ~2, ~3
          5        JMP_SET                                              ~5      ~4, ->10
    6     6        FETCH_DIM_R                                          ~6      !0, 1
          7        FETCH_DIM_R                                          ~7      !1, 1
          8        SPACESHIP                                            ~8      ~6, ~7
          9        QM_ASSIGN                                            ~5      ~8
         10        JMP_SET                                              ~9      ~5, ->15
    7    11        FETCH_DIM_R                                          ~10     !0, 2
         12        FETCH_DIM_R                                          ~11     !1, 2
         13        SPACESHIP                                            ~12     ~10, ~11
         14        QM_ASSIGN                                            ~9      ~12
         15        JMP_SET                                              ~13     ~9, ->17
    8    16        QM_ASSIGN                                            ~13     0
         17      > RETURN                                                       ~13
    9    18*     > RETURN                                                       null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
172.87 ms | 1511 KiB | 16 Q