3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ 1,3,1,8,9,7,6,4 ]; print_r($arr); uasort($arr, function($a, $b){ return abs(3-$a) - abs(3-$b); }); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Xk3D
function name:  (null)
number of ops:  13
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'print_r'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                                 
   11     4        INIT_FCALL                                               'uasort'
          5        SEND_REF                                                 !0
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F4Xk3D%3A11%240'
   13     7        SEND_VAL                                                 ~3
          8        DO_ICALL                                                 
   15     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F4Xk3D%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4Xk3D
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'abs'
          3        SUB                                              ~2      3, !0
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                         $3      
          6        INIT_FCALL                                               'abs'
          7        SUB                                              ~4      3, !1
          8        SEND_VAL                                                 ~4
          9        DO_ICALL                                         $5      
         10        SUB                                              ~6      $3, $5
         11      > RETURN                                                   ~6
   13    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F4Xk3D%3A11%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.59 ms | 1399 KiB | 19 Q