3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = ['a', 'b', 'a', 'c']; uasort($ar, function($a, $b){ if ($a > $b) { return 1; } if ($a < $b) { return -1; } return 0; }); print_r($ar); echo PHP_EOL; uasort($ar, function($a, $b){ return strcasecmp($a, $b); }); print_r($ar); echo PHP_EOL; uasort($ar, function($a, $b){ return strcmp($a, $b); }); print_r($ar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EVlB5
function name:  (null)
number of ops:  28
compiled vars:  !0 = $ar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEVlB5%3A4%240'
   12     4        SEND_VAL                                                 ~2
          5        DO_ICALL                                                 
   13     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   14     9        ECHO                                                     '%0A'
   16    10        INIT_FCALL                                               'uasort'
         11        SEND_REF                                                 !0
         12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEVlB5%3A16%241'
   18    13        SEND_VAL                                                 ~5
         14        DO_ICALL                                                 
   19    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   20    18        ECHO                                                     '%0A'
   22    19        INIT_FCALL                                               'uasort'
         20        SEND_REF                                                 !0
         21        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEVlB5%3A22%242'
   24    22        SEND_VAL                                                 ~8
         23        DO_ICALL                                                 
   25    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FEVlB5%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EVlB5
function name:  {closure}
number of ops:  10
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        IS_SMALLER                                               !1, !0
          3      > JMPZ                                                     ~2, ->5
    6     4    > > RETURN                                                   1
    8     5    >   IS_SMALLER                                               !0, !1
          6      > JMPZ                                                     ~3, ->8
    9     7    > > RETURN                                                   -1
   11     8    > > RETURN                                                   0
   12     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEVlB5%3A4%240

Function %00%7Bclosure%7D%2Fin%2FEVlB5%3A16%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EVlB5
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        INIT_FCALL                                               'strcasecmp'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   18     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEVlB5%3A16%241

Function %00%7Bclosure%7D%2Fin%2FEVlB5%3A22%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EVlB5
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   23     2        INIT_FCALL                                               'strcmp'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   24     7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEVlB5%3A22%242

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.98 ms | 1400 KiB | 21 Q