3v4l.org

run code in 300+ PHP versions simultaneously
<?php $s = [ 25, 12, 23, 1006, 13, 114, 11, 34, 18, 13, 112 ]; sort($s); $func = function($a, $b){ $first_digitA = substr($a, 0, 1); $first_digitB = substr($b, 0, 1); if($first_digitA < $first_digitB){ return -1; } else if( $first_digitA > $first_digitB ){ return 1; } else { return 0; } }; usort($s, $func); print_r($s);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eq2qq
function name:  (null)
number of ops:  14
compiled vars:  !0 = $s, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'sort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    6     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        ASSIGN                                                   !1, ~4
   24     6        INIT_FCALL                                               'usort'
          7        SEND_REF                                                 !0
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
   26    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Eq2qq
function name:  {closure}
number of ops:  24
compiled vars:  !0 = $a, !1 = $b, !2 = $first_digitA, !3 = $first_digitB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !2, $4
    9     8        INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $6      
         13        ASSIGN                                                   !3, $6
   11    14        IS_SMALLER                                               !2, !3
         15      > JMPZ                                                     ~8, ->18
   12    16    > > RETURN                                                   -1
   11    17*       JMP                                                      ->23
   15    18    >   IS_SMALLER                                               !3, !2
         19      > JMPZ                                                     ~9, ->22
   16    20    > > RETURN                                                   1
   15    21*       JMP                                                      ->23
   20    22    > > RETURN                                                   0
   22    23*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.25 ms | 1018 KiB | 17 Q