3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_error_handler(function($errno, $errstr) { $bt = debug_backtrace(); var_dump($errstr); }); $input = array( 'first' => array(), 'second' => array('position' => 2), array('something' => 5), NULL => array('error' => 1), ); $displays = array(); foreach ($input as $key => $options) { $options += array( 'display_options' => array(), 'display_plugin' => NULL, 'id' => NULL, 'display_title' => '', 'position' => NULL, ); // Add the defaults for the display. $displays[$key] = $options; } uasort($displays, function ($display1, $display2) { if ($display1['position'] != $display2['position']) { return $display1['position'] < $display2['position'] ? -1 : 1; } return 0; }); print_r($displays);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/2JNRP
function name:  (null)
number of ops:  23
compiled vars:  !0 = $input, !1 = $displays, !2 = $options, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2JNRP%3A3%240'
    6     2        SEND_VAL                                                 ~4
          3        DO_ICALL                                                 
    8     4        ASSIGN                                                   !0, <array>
   14     5        ASSIGN                                                   !1, <array>
   15     6      > FE_RESET_R                                       $8      !0, ->13
          7    > > FE_FETCH_R                                       ~9      $8, !2, ->13
          8    >   ASSIGN                                                   !3, ~9
   17     9        ASSIGN_OP                                     1          !2, <array>
   24    10        ASSIGN_DIM                                               !1, !3
         11        OP_DATA                                                  !2
   15    12      > JMP                                                      ->7
         13    >   FE_FREE                                                  $8
   28    14        INIT_FCALL                                               'uasort'
         15        SEND_REF                                                 !1
         16        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F2JNRP%3A28%241'
   33    17        SEND_VAL                                                 ~13
         18        DO_ICALL                                                 
   35    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F2JNRP%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2JNRP
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $bt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'debug_backtrace'
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !2, $3
    5     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
    6     8      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2JNRP%3A3%240

Function %00%7Bclosure%7D%2Fin%2F2JNRP%3A28%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 14
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2JNRP
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $display1, !1 = $display2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2        FETCH_DIM_R                                      ~2      !0, 'position'
          3        FETCH_DIM_R                                      ~3      !1, 'position'
          4        IS_NOT_EQUAL                                             ~2, ~3
          5      > JMPZ                                                     ~4, ->14
   30     6    >   FETCH_DIM_R                                      ~5      !0, 'position'
          7        FETCH_DIM_R                                      ~6      !1, 'position'
          8        IS_SMALLER                                               ~5, ~6
          9      > JMPZ                                                     ~7, ->12
         10    >   QM_ASSIGN                                        ~8      -1
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~8      1
         13    > > RETURN                                                   ~8
   32    14    > > RETURN                                                   0
   33    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F2JNRP%3A28%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.97 ms | 1400 KiB | 23 Q