3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FooTable { public function getTable() { $table_cells = range(1, 100); $table = $this->chunk($table_cells, 10); foreach ($table as $row) { echo implode(' | ', $row) . PHP_EOL; } } public function chunk(array $array, $chunk_size) { $index = 0; while ($index < count($array)) { yield array_slice($array, $index, $chunk_size, true); $index += $chunk_size; } } } $foo = new FooTable; echo $foo->getTable();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3SZpe
function name:  (null)
number of ops:  7
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   NEW                                              $1      'FooTable'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   28     3        INIT_METHOD_CALL                                         !0, 'getTable'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
          6      > RETURN                                                   1

Class FooTable:
Function gettable:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/3SZpe
function name:  getTable
number of ops:  21
compiled vars:  !0 = $table_cells, !1 = $table, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 100
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !0, $3
    9     5        INIT_METHOD_CALL                                         'chunk'
          6        SEND_VAR_EX                                              !0
          7        SEND_VAL_EX                                              10
          8        DO_FCALL                                      0  $5      
          9        ASSIGN                                                   !1, $5
   11    10      > FE_RESET_R                                       $7      !1, ->19
         11    > > FE_FETCH_R                                               $7, !2, ->19
   12    12    >   INIT_FCALL                                               'implode'
         13        SEND_VAL                                                 '+%7C+'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $8      
         16        CONCAT                                           ~9      $8, '%0A'
         17        ECHO                                                     ~9
   11    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $7
   14    20      > RETURN                                                   null

End of function gettable

Function chunk:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
1 jumps found. (Code = 161) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 5
Branch analysis from position: 16
Branch analysis from position: 5
filename:       /in/3SZpe
function name:  chunk
number of ops:  17
compiled vars:  !0 = $array, !1 = $chunk_size, !2 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        GENERATOR_CREATE                                         
   18     3        ASSIGN                                                   !2, 0
   19     4      > JMP                                                      ->13
   20     5    >   INIT_FCALL                                               'array_slice'
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !2
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $4      
         11        YIELD                                                    $4
   21    12        ASSIGN_OP                                     1          !2, !1
   19    13    >   COUNT                                            ~7      !0
         14        IS_SMALLER                                               !2, ~7
         15      > JMPNZ                                                    ~8, ->5
   23    16    > > GENERATOR_RETURN                                         

End of function chunk

End of class FooTable.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.65 ms | 1400 KiB | 19 Q