3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( "item1"=>"1", "item2"=>"3", "item3"=>"5", "item4"=>"2", "item5"=>"4" ); $sortingArr = array("5","4","3","2","1"); uasort($data, function($a, $b) use ($sortingArr) { return array_search($a, $sortingArr) <=> array_search($b, $sortingArr); }); print_r($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bbIk2
function name:  (null)
number of ops:  12
compiled vars:  !0 = $data, !1 = $sortingArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   13     2        INIT_FCALL                                               'uasort'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   15     6        SEND_VAL                                                 ~4
   13     7        DO_ICALL                                                 
   17     8        INIT_FCALL                                               'print_r'
          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/bbIk2
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $a, !1 = $b, !2 = $sortingArr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   14     3        INIT_FCALL                                               'array_search'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $3      
          7        INIT_FCALL                                               'array_search'
          8        SEND_VAR                                                 !1
          9        SEND_VAR                                                 !2
         10        DO_ICALL                                         $4      
         11        SPACESHIP                                        ~5      $3, $4
         12      > RETURN                                                   ~5
   15    13*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.65 ms | 1000 KiB | 16 Q