3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array('value' => 1), array('value' => 2), array('value' => 2), //Move this array('value' => 2), //Move the also second duplicate array('value' => 'A'), array('value' => 'B'), array('value' => 'C'), array('value' => 6), array('value' => 7), array('value' => 7), //Move this array('value' => 8), array('value' => 9), array('value' => 10), array('value' => 11) ); usort($array, function($a, $b){ return strcmp($a['value'], $b['value']);}); $chunks = array_chunk($array, ceil(count($array)/5)); $array = array(); for($x = 0, $numX = count($chunks[0]); $x < $numX; $x++){ for($y = 0, $numY = count($chunks); $y < $numY; $y++){ $array[] = $chunks[$y][$x]; } } print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 22
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 26
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 22
Branch analysis from position: 36
Branch analysis from position: 22
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 26
Branch analysis from position: 33
Branch analysis from position: 26
filename:       /in/BtYMG
function name:  (null)
number of ops:  40
compiled vars:  !0 = $array, !1 = $chunks, !2 = $x, !3 = $numX, !4 = $y, !5 = $numY
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FBtYMG%3A20%240'
          4        SEND_VAL                                                 ~7
          5        DO_ICALL                                                 
   22     6        INIT_FCALL                                               'array_chunk'
          7        SEND_VAR                                                 !0
          8        INIT_FCALL                                               'ceil'
          9        COUNT                                            ~9      !0
         10        DIV                                              ~10     ~9, 5
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                         $11     
         13        SEND_VAR                                                 $11
         14        DO_ICALL                                         $12     
         15        ASSIGN                                                   !1, $12
   23    16        ASSIGN                                                   !0, <array>
   25    17        ASSIGN                                                   !2, 0
         18        FETCH_DIM_R                                      ~16     !1, 0
         19        COUNT                                            ~17     ~16
         20        ASSIGN                                                   !3, ~17
         21      > JMP                                                      ->34
   26    22    >   ASSIGN                                                   !4, 0
         23        COUNT                                            ~20     !1
         24        ASSIGN                                                   !5, ~20
         25      > JMP                                                      ->31
   27    26    >   FETCH_DIM_R                                      ~23     !1, !4
         27        FETCH_DIM_R                                      ~24     ~23, !2
         28        ASSIGN_DIM                                               !0
         29        OP_DATA                                                  ~24
   26    30        PRE_INC                                                  !4
         31    >   IS_SMALLER                                               !4, !5
         32      > JMPNZ                                                    ~26, ->26
   25    33    >   PRE_INC                                                  !2
         34    >   IS_SMALLER                                               !2, !3
         35      > JMPNZ                                                    ~28, ->22
   31    36    >   INIT_FCALL                                               'print_r'
         37        SEND_VAR                                                 !0
         38        DO_ICALL                                                 
         39      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FBtYMG%3A20%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BtYMG
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_FCALL                                               'strcmp'
          3        FETCH_DIM_R                                      ~2      !0, 'value'
          4        SEND_VAL                                                 ~2
          5        FETCH_DIM_R                                      ~3      !1, 'value'
          6        SEND_VAL                                                 ~3
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
          9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FBtYMG%3A20%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.76 ms | 1400 KiB | 23 Q