3v4l.org

run code in 500+ PHP versions simultaneously
<?php $data = array('person f','person c','person g','person a','person d','person e'); $last = array('person a','person c','person g'); usort($data,function($a,$b) use($last){ return in_array($a,$last) <=> in_array($b,$last) //sort if in $last ?: $a <=> $b; //sort alphabetically }); var_export($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3G8s
function name:  (null)
number of ops:  12
compiled vars:  !0 = $data, !1 = $last
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    5     1        ASSIGN                                                       !1, <array>
    7     2        INIT_FCALL                                                   'usort'
          3        SEND_REF                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !1
   10     6        SEND_VAL                                                     ~4
    7     7        DO_ICALL                                                     
   12     8        INIT_FCALL                                                   'var_export'
          9        SEND_VAR                                                     !0
         10        DO_ICALL                                                     
         11      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B3G8s
function name:  {closure:/in/B3G8s:7}
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $last
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
    8     3        FRAMELESS_ICALL_2                in_array            ~3      !0, !2
          4        FRAMELESS_ICALL_2                in_array            ~4      !1, !2
          5        SPACESHIP                                            ~5      ~3, ~4
          6        JMP_SET                                              ~6      ~5, ->9
    9     7        SPACESHIP                                            ~7      !0, !1
          8        QM_ASSIGN                                            ~6      ~7
          9      > RETURN                                                       ~6
   10    10*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
157.28 ms | 1875 KiB | 15 Q