3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( 'a', 'b', 'c', 'd', 'e', 'f', 'g' ); $array = array_reverse($array); $chunk = array_chunk($array, 3); print_r($chunk); $chunk[count($chunk)-1][] = $chunk[0][count($chunk)-1]; unset($chunk[0][count($chunk)-1]); print_r($chunk); $array = array_map('array_reverse', $chunk); print_r(array_reverse($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8U52a
function name:  (null)
number of ops:  41
compiled vars:  !0 = $array, !1 = $chunk
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_reverse'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
   15     5        INIT_FCALL                                               'array_chunk'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 3
          8        DO_ICALL                                         $5      
          9        ASSIGN                                                   !1, $5
   16    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
   17    13        COUNT                                            ~8      !1
         14        SUB                                              ~9      ~8, 1
         15        COUNT                                            ~13     !1
         16        SUB                                              ~14     ~13, 1
         17        FETCH_DIM_R                                      ~12     !1, 0
         18        FETCH_DIM_R                                      ~15     ~12, ~14
         19        FETCH_DIM_W                                      $10     !1, ~9
         20        ASSIGN_DIM                                               $10
         21        OP_DATA                                                  ~15
   18    22        COUNT                                            ~17     !1
         23        SUB                                              ~18     ~17, 1
         24        FETCH_DIM_UNSET                                  $16     !1, 0
         25        UNSET_DIM                                                $16, ~18
   19    26        INIT_FCALL                                               'print_r'
         27        SEND_VAR                                                 !1
         28        DO_ICALL                                                 
   20    29        INIT_FCALL                                               'array_map'
         30        SEND_VAL                                                 'array_reverse'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                         $20     
         33        ASSIGN                                                   !0, $20
   21    34        INIT_FCALL                                               'print_r'
         35        INIT_FCALL                                               'array_reverse'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $22     
         38        SEND_VAR                                                 $22
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151 ms | 1014 KiB | 17 Q