3v4l.org

run code in 300+ PHP versions simultaneously
<?php function paginateTable(array $data = [], int $limit = 10, int $start = 0) { return array_slice($data, abs($start), abs($limit)); } $tests = [ [], range('a', 'h'), [14, 15, 16] ]; foreach ($tests as $i => $test) { var_export(paginateTable($test, 5, $i)); echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 21
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/P545l
function name:  (null)
number of ops:  23
compiled vars:  !0 = $tests, !1 = $test, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_ARRAY                                       ~3      <array>
   10     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 'a'
          3        SEND_VAL                                                 'h'
          4        DO_ICALL                                         $4      
          5        ADD_ARRAY_ELEMENT                                ~3      $4
    9     6        ADD_ARRAY_ELEMENT                                ~3      <array>
    8     7        ASSIGN                                                   !0, ~3
   13     8      > FE_RESET_R                                       $6      !0, ->21
          9    > > FE_FETCH_R                                       ~7      $6, !1, ->21
         10    >   ASSIGN                                                   !2, ~7
   14    11        INIT_FCALL                                               'var_export'
         12        INIT_FCALL                                               'paginatetable'
         13        SEND_VAR                                                 !1
         14        SEND_VAL                                                 5
         15        SEND_VAR                                                 !2
         16        DO_FCALL                                      0  $9      
         17        SEND_VAR                                                 $9
         18        DO_ICALL                                                 
   15    19        ECHO                                                     '%0A---%0A'
   13    20      > JMP                                                      ->9
         21    >   FE_FREE                                                  $6
   16    22      > RETURN                                                   1

Function paginatetable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/P545l
function name:  paginateTable
number of ops:  16
compiled vars:  !0 = $data, !1 = $limit, !2 = $start
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      <array>
          1        RECV_INIT                                        !1      10
          2        RECV_INIT                                        !2      0
    5     3        INIT_FCALL                                               'array_slice'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'abs'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        INIT_FCALL                                               'abs'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $4      
         12        SEND_VAR                                                 $4
         13        DO_ICALL                                         $5      
         14      > RETURN                                                   $5
    6    15*     > RETURN                                                   null

End of function paginatetable

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
130.42 ms | 1407 KiB | 22 Q