3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = range(0, 10); usort($array, withBool(...)); print(implode(', ', $array)).PHP_EOL; // 9, 10, 7, 8, 5, 6, 4, 3, 2, 1, 0 usort($array, withInt(...)); print(implode(', ', $array)).PHP_EOL; // 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 function withBool($a, $b) : bool { return $a <=> $b; } function withInt($a, $b) : int { return $a <=> $b; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BATHJ
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'range'
          1        SEND_VAL                                                     0
          2        SEND_VAL                                                     10
          3        DO_ICALL                                             $1      
          4        ASSIGN                                                       !0, $1
    5     5        INIT_FCALL                                                   'usort'
          6        SEND_REF                                                     !0
          7        INIT_FCALL_BY_NAME                                           'withBool'
          8        CALLABLE_CONVERT                                     ~3      
          9        SEND_VAL                                                     ~3
         10        DO_ICALL                                                     
    6    11        FRAMELESS_ICALL_2                implode             ~5      '%2C+', !0
         12        CONCAT                                               ~6      ~5, '%0A'
         13        ECHO                                                         ~6
    9    14        INIT_FCALL                                                   'usort'
         15        SEND_REF                                                     !0
         16        INIT_FCALL_BY_NAME                                           'withInt'
         17        CALLABLE_CONVERT                                     ~7      
         18        SEND_VAL                                                     ~7
         19        DO_ICALL                                                     
   10    20        FRAMELESS_ICALL_2                implode             ~9      '%2C+', !0
         21        CONCAT                                               ~10     ~9, '%0A'
         22        ECHO                                                         ~10
   17    23      > RETURN                                                       1

Function withbool:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BATHJ
function name:  withBool
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        SPACESHIP                                            ~2      !0, !1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
          5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function withbool

Function withint:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BATHJ
function name:  withInt
number of ops:  7
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        SPACESHIP                                            ~2      !0, !1
          3        VERIFY_RETURN_TYPE                                           ~2
          4      > RETURN                                                       ~2
          5*       VERIFY_RETURN_TYPE                                           
          6*     > RETURN                                                       null

End of function withint

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
147.24 ms | 1492 KiB | 15 Q