3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pageNumber = 1; $pageHeight = 7; $commands = [ "foo" => ["name" => "foo", "desc" => "Foo Desc", "perm" => true], "fuu" => ["name" => "fuu", "desc" => "Fuu Desc", "perm" => false], "bar" => ["name" => "bar", "desc" => "Foo Desc", "perm" => true], ]; ksort($commands, SORT_NATURAL | SORT_FLAG_CASE); $commands = array_chunk($commands, $pageHeight); $pageNumber = (int) min(count($commands), $pageNumber); printf("PageNumber=%d, CountCommands=%d", $pageNumber, count($commands)); foreach($commands[$pageNumber - 1] as $command){ printf("Name=%s, Desc=%s", $command["name"], $command["desc"]); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 28, Position 2 = 37
Branch analysis from position: 28
2 jumps found. (Code = 78) Position 1 = 29, Position 2 = 37
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/T0veY
function name:  (null)
number of ops:  39
compiled vars:  !0 = $pageNumber, !1 = $pageHeight, !2 = $commands, !3 = $command
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 1
    5     1        ASSIGN                                                   !1, 7
    7     2        ASSIGN                                                   !2, <array>
   13     3        INIT_FCALL                                               'ksort'
          4        SEND_REF                                                 !2
          5        SEND_VAL                                                 14
          6        DO_ICALL                                                 
   14     7        INIT_FCALL                                               'array_chunk'
          8        SEND_VAR                                                 !2
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $8      
         11        ASSIGN                                                   !2, $8
   15    12        INIT_FCALL                                               'min'
         13        COUNT                                            ~10     !2
         14        SEND_VAL                                                 ~10
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $11     
         17        CAST                                          4  ~12     $11
         18        ASSIGN                                                   !0, ~12
   17    19        INIT_FCALL                                               'printf'
         20        SEND_VAL                                                 'PageNumber%3D%25d%2C+CountCommands%3D%25d'
         21        SEND_VAR                                                 !0
         22        COUNT                                            ~14     !2
         23        SEND_VAL                                                 ~14
         24        DO_ICALL                                                 
   18    25        SUB                                              ~16     !0, 1
         26        FETCH_DIM_R                                      ~17     !2, ~16
         27      > FE_RESET_R                                       $18     ~17, ->37
         28    > > FE_FETCH_R                                               $18, !3, ->37
   19    29    >   INIT_FCALL                                               'printf'
         30        SEND_VAL                                                 'Name%3D%25s%2C+Desc%3D%25s'
         31        FETCH_DIM_R                                      ~19     !3, 'name'
         32        SEND_VAL                                                 ~19
         33        FETCH_DIM_R                                      ~20     !3, 'desc'
         34        SEND_VAL                                                 ~20
         35        DO_ICALL                                                 
   18    36      > JMP                                                      ->28
         37    >   FE_FREE                                                  $18
   20    38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.74 ms | 1396 KiB | 21 Q