3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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 = 3, Position 2 = 9
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 9
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/PDUj3
function name:  (null)
number of ops:  19
compiled vars:  !0 = $input, !1 = $displays, !2 = $options, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $6      !0, ->9
          3    > > FE_FETCH_R                                       ~7      $6, !2, ->9
          4    >   ASSIGN                                                   !3, ~7
   12     5        ASSIGN_OP                                     1          !2, <array>
   19     6        ASSIGN_DIM                                               !1, !3
          7        OP_DATA                                                  !2
   10     8      > JMP                                                      ->3
          9    >   FE_FREE                                                  $6
   23    10        INIT_FCALL                                               'uasort'
         11        SEND_REF                                                 !1
         12        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPDUj3%3A23%240'
   28    13        SEND_VAL                                                 ~11
         14        DO_ICALL                                                 
   30    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPDUj3%3A23%240:
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/PDUj3
function name:  {closure}
number of ops:  16
compiled vars:  !0 = $display1, !1 = $display2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        FETCH_DIM_R                                      ~2      !0, 'position'
          3        FETCH_DIM_R                                      ~3      !1, 'position'
          4        IS_NOT_EQUAL                                             ~2, ~3
          5      > JMPZ                                                     ~4, ->14
   25     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
   27    14    > > RETURN                                                   0
   28    15*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FPDUj3%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.29 ms | 1400 KiB | 17 Q