3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array1 = [ [536870914 => 34213897], [536870914 => 34213905], [536870915 => 34213921], [536870914 => 34213913], [536870915 => 34213929], [536870917 => 34213937], [536870925 => 34218049], ]; $array2 = [ 536870925, 536870914, 536870915, 536870917, ]; usort($array1, function($a, $b) use ($array2) { return array_search(key($a), $array2) <=> array_search(key($b), $array2); }); var_export($array1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nZSCs
function name:  (null)
number of ops:  12
compiled vars:  !0 = $array1, !1 = $array2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   12     1        ASSIGN                                                       !1, <array>
   19     2        INIT_FCALL                                                   'usort'
          3        SEND_REF                                                     !0
          4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !1
   21     6        SEND_VAL                                                     ~4
   19     7        DO_ICALL                                                     
   23     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/nZSCs
function name:  {closure:/in/nZSCs:19}
number of ops:  20
compiled vars:  !0 = $a, !1 = $b, !2 = $array2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        BIND_STATIC                                                  !2
   20     3        INIT_FCALL                                                   'array_search'
          4        INIT_FCALL                                                   'key'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $3      
          7        SEND_VAR                                                     $3
          8        SEND_VAR                                                     !2
          9        DO_ICALL                                             $4      
         10        INIT_FCALL                                                   'array_search'
         11        INIT_FCALL                                                   'key'
         12        SEND_VAR                                                     !1
         13        DO_ICALL                                             $5      
         14        SEND_VAR                                                     $5
         15        SEND_VAR                                                     !2
         16        DO_ICALL                                             $6      
         17        SPACESHIP                                            ~7      $4, $6
         18      > RETURN                                                       ~7
   21    19*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
163.07 ms | 2370 KiB | 17 Q