3v4l.org

run code in 300+ PHP versions simultaneously
<?php function uasort_key(&$arr, $func) { return uksort($arr, function($a,$b) use(&$arr,$func) { return $func($arr[$a], $arr[$b], $a, $b); }); } function sort_me($a, $b, $ka = 0, $kb = 0) { return ($a < $b ? -1 : ($a > $b ? 1 : ($ka < $kb ? -1 : ($ka > $kb ? 1 : 0)) )); } $test_array = array(4,6,2,1,7,5,1,34,1,0,4); $test_array_uasort_key = $test_array; uasort_key($test_array_uasort_key, 'sort_me'); print_r($test_array_uasort_key);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uqO8
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test_array, !1 = $test_array_uasort_key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ASSIGN                                                   !0, <array>
   16     1        ASSIGN                                                   !1, !0
   18     2        INIT_FCALL                                               'uasort_key'
          3        SEND_REF                                                 !1
          4        SEND_VAL                                                 'sort_me'
          5        DO_FCALL                                      0          
   20     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function uasort_key:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uqO8
function name:  uasort_key
number of ops:  11
compiled vars:  !0 = $arr, !1 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'uksort'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F9uqO8%3A4%240'
          5        BIND_LEXICAL                                             ~2, !0
          6        BIND_LEXICAL                                             ~2, !1
    6     7        SEND_VAL                                                 ~2
          8        DO_ICALL                                         $3      
          9      > RETURN                                                   $3
    7    10*     > RETURN                                                   null

End of function uasort_key

Function %00%7Bclosure%7D%2Fin%2F9uqO8%3A4%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uqO8
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $a, !1 = $b, !2 = $arr, !3 = $func
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
    5     4        INIT_DYNAMIC_CALL                                        !3
          5        CHECK_FUNC_ARG                                           
          6        FETCH_DIM_FUNC_ARG                               $4      !2, !0
          7        SEND_FUNC_ARG                                            $4
          8        CHECK_FUNC_ARG                                           
          9        FETCH_DIM_FUNC_ARG                               $5      !2, !1
         10        SEND_FUNC_ARG                                            $5
         11        SEND_VAR_EX                                              !0
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0  $6      
         14      > RETURN                                                   $6
    6    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F9uqO8%3A4%240

Function sort_me:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9uqO8
function name:  sort_me
number of ops:  26
compiled vars:  !0 = $a, !1 = $b, !2 = $ka, !3 = $kb
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      0
          3        RECV_INIT                                        !3      0
   10     4        IS_SMALLER                                               !0, !1
          5      > JMPZ                                                     ~4, ->8
          6    >   QM_ASSIGN                                        ~5      -1
          7      > JMP                                                      ->24
          8    >   IS_SMALLER                                               !1, !0
          9      > JMPZ                                                     ~6, ->12
         10    >   QM_ASSIGN                                        ~7      1
         11      > JMP                                                      ->23
   11    12    >   IS_SMALLER                                               !2, !3
         13      > JMPZ                                                     ~8, ->16
         14    >   QM_ASSIGN                                        ~9      -1
         15      > JMP                                                      ->22
         16    >   IS_SMALLER                                               !3, !2
         17      > JMPZ                                                     ~10, ->20
         18    >   QM_ASSIGN                                        ~11     1
         19      > JMP                                                      ->21
         20    >   QM_ASSIGN                                        ~11     0
         21    >   QM_ASSIGN                                        ~9      ~11
         22    >   QM_ASSIGN                                        ~7      ~9
         23    >   QM_ASSIGN                                        ~5      ~7
         24    > > RETURN                                                   ~5
   13    25*     > RETURN                                                   null

End of function sort_me

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.54 ms | 1402 KiB | 18 Q