3v4l.org

run code in 300+ PHP versions simultaneously
<?php $menu = array( array(1,3,'Wurm 1.1', 2, 10), array(2,6,'Vogel 2.1', 2, 30), array(3,0,'Tiger 1', 1, 10), array(4,6,'Hund 2.2', 2, 40), array(5,3,'Katze 1.2', 2, 11), array(6,0,'Pferd 2', 1, 20), array(7,1,'Baer 1.1.1', 3, 0), array(8,3,'Schwein 1.3', 2, 12), array(9,4,'Esel 2.2.1', 3, 0), ); // Algorithmus hier uasort($menu, function($a,$b) { return $a[1] == $b[1] ? 0 : ($a[1] < $b[1] ? -1 : 1); }); print_r($menu); $result = array(); $target = array( array(3,0,'Tiger 1', 1, 10), array(1,3,'Wurm 1.1', 2, 10), array(7,1,'Baer 1.1.1', 3, 0), array(5,3,'Katze 1.2', 2, 11), array(8,3,'Schwein 1.3', 2, 12), array(6,0,'Pferd 2', 1, 20), array(2,6,'Vogel 2.1', 2, 30), array(4,6,'Hund 2.2', 2, 40), array(9,4,'Esel 2.2.1', 3, 0), ); var_dump($result == $target);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJe4d
function name:  (null)
number of ops:  16
compiled vars:  !0 = $menu, !1 = $result, !2 = $target
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   16     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLJe4d%3A16%240'
   18     4        SEND_VAL                                                 ~4
          5        DO_ICALL                                                 
   20     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   22     9        ASSIGN                                                   !1, <array>
   26    10        ASSIGN                                                   !2, <array>
   38    11        INIT_FCALL                                               'var_dump'
         12        IS_EQUAL                                         ~9      !1, !2
         13        SEND_VAL                                                 ~9
         14        DO_ICALL                                                 
         15      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLJe4d%3A16%240:
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 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LJe4d
function name:  {closure}
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   17     2        FETCH_DIM_R                                      ~2      !0, 1
          3        FETCH_DIM_R                                      ~3      !1, 1
          4        IS_EQUAL                                                 ~2, ~3
          5      > JMPZ                                                     ~4, ->8
          6    >   QM_ASSIGN                                        ~5      0
          7      > JMP                                                      ->16
          8    >   FETCH_DIM_R                                      ~6      !0, 1
          9        FETCH_DIM_R                                      ~7      !1, 1
         10        IS_SMALLER                                               ~6, ~7
         11      > JMPZ                                                     ~8, ->14
         12    >   QM_ASSIGN                                        ~9      -1
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~9      1
         15    >   QM_ASSIGN                                        ~5      ~9
         16    > > RETURN                                                   ~5
   18    17*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FLJe4d%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.12 ms | 1400 KiB | 19 Q