3v4l.org

run code in 300+ PHP versions simultaneously
<?php function terminal_table($col1, $col2, $max_num_spaces_between_columns) { $num_spaces = $max_num_spaces_between_columns - mb_strlen($col1); if ($num_spaces <= 0) $num_spaces = 1; // Always at least 1 space. return $col1 . str_repeat(' ', $num_spaces) . $col2; } echo terminal_table('Cats', '1', 32) . "\n"; echo terminal_table('Dogs', '2', 32) . "\n"; echo terminal_table('Rabbits', '999', 32) . "\n"; echo terminal_table('Horses', '16', 32) . "\n"; echo terminal_table('Cows', '64', 32) . "\n"; echo terminal_table('Mice', '5', 32) . "\n"; echo terminal_table('Pigs', '16', 32) . "\n"; function tabify($col1, $col2, $numTabs) { $tabs = ''; for ($x = 0; $x < $numTabs; $x ++) { $tabs .= "\t"; } return $col1 . $tabs . $col2; } echo tabify('Cats', '1', 3) . "\n"; echo tabify('Dogs', '2', 3) . "\n"; echo tabify('Rabbits', '999', 3) . "\n"; echo tabify('Horses', '16', 3) . "\n"; echo tabify('Cows', '64', 3) . "\n"; echo tabify('Mice', '5', 3) . "\n"; echo tabify('Pigs', '16', 3) . "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/66ntp
function name:  (null)
number of ops:  99
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'terminal_table'
          1        SEND_VAL                                                 'Cats'
          2        SEND_VAL                                                 '1'
          3        SEND_VAL                                                 32
          4        DO_FCALL                                      0  $0      
          5        CONCAT                                           ~1      $0, '%0A'
          6        ECHO                                                     ~1
   14     7        INIT_FCALL                                               'terminal_table'
          8        SEND_VAL                                                 'Dogs'
          9        SEND_VAL                                                 '2'
         10        SEND_VAL                                                 32
         11        DO_FCALL                                      0  $2      
         12        CONCAT                                           ~3      $2, '%0A'
         13        ECHO                                                     ~3
   15    14        INIT_FCALL                                               'terminal_table'
         15        SEND_VAL                                                 'Rabbits'
         16        SEND_VAL                                                 '999'
         17        SEND_VAL                                                 32
         18        DO_FCALL                                      0  $4      
         19        CONCAT                                           ~5      $4, '%0A'
         20        ECHO                                                     ~5
   16    21        INIT_FCALL                                               'terminal_table'
         22        SEND_VAL                                                 'Horses'
         23        SEND_VAL                                                 '16'
         24        SEND_VAL                                                 32
         25        DO_FCALL                                      0  $6      
         26        CONCAT                                           ~7      $6, '%0A'
         27        ECHO                                                     ~7
   17    28        INIT_FCALL                                               'terminal_table'
         29        SEND_VAL                                                 'Cows'
         30        SEND_VAL                                                 '64'
         31        SEND_VAL                                                 32
         32        DO_FCALL                                      0  $8      
         33        CONCAT                                           ~9      $8, '%0A'
         34        ECHO                                                     ~9
   18    35        INIT_FCALL                                               'terminal_table'
         36        SEND_VAL                                                 'Mice'
         37        SEND_VAL                                                 '5'
         38        SEND_VAL                                                 32
         39        DO_FCALL                                      0  $10     
         40        CONCAT                                           ~11     $10, '%0A'
         41        ECHO                                                     ~11
   19    42        INIT_FCALL                                               'terminal_table'
         43        SEND_VAL                                                 'Pigs'
         44        SEND_VAL                                                 '16'
         45        SEND_VAL                                                 32
         46        DO_FCALL                                      0  $12     
         47        CONCAT                                           ~13     $12, '%0A'
         48        ECHO                                                     ~13
   31    49        INIT_FCALL                                               'tabify'
         50        SEND_VAL                                                 'Cats'
         51        SEND_VAL                                                 '1'
         52        SEND_VAL                                                 3
         53        DO_FCALL                                      0  $14     
         54        CONCAT                                           ~15     $14, '%0A'
         55        ECHO                                                     ~15
   32    56        INIT_FCALL                                               'tabify'
         57        SEND_VAL                                                 'Dogs'
         58        SEND_VAL                                                 '2'
         59        SEND_VAL                                                 3
         60        DO_FCALL                                      0  $16     
         61        CONCAT                                           ~17     $16, '%0A'
         62        ECHO                                                     ~17
   33    63        INIT_FCALL                                               'tabify'
         64        SEND_VAL                                                 'Rabbits'
         65        SEND_VAL                                                 '999'
         66        SEND_VAL                                                 3
         67        DO_FCALL                                      0  $18     
         68        CONCAT                                           ~19     $18, '%0A'
         69        ECHO                                                     ~19
   34    70        INIT_FCALL                                               'tabify'
         71        SEND_VAL                                                 'Horses'
         72        SEND_VAL                                                 '16'
         73        SEND_VAL                                                 3
         74        DO_FCALL                                      0  $20     
         75        CONCAT                                           ~21     $20, '%0A'
         76        ECHO                                                     ~21
   35    77        INIT_FCALL                                               'tabify'
         78        SEND_VAL                                                 'Cows'
         79        SEND_VAL                                                 '64'
         80        SEND_VAL                                                 3
         81        DO_FCALL                                      0  $22     
         82        CONCAT                                           ~23     $22, '%0A'
         83        ECHO                                                     ~23
   36    84        INIT_FCALL                                               'tabify'
         85        SEND_VAL                                                 'Mice'
         86        SEND_VAL                                                 '5'
         87        SEND_VAL                                                 3
         88        DO_FCALL                                      0  $24     
         89        CONCAT                                           ~25     $24, '%0A'
         90        ECHO                                                     ~25
   37    91        INIT_FCALL                                               'tabify'
         92        SEND_VAL                                                 'Pigs'
         93        SEND_VAL                                                 '16'
         94        SEND_VAL                                                 3
         95        DO_FCALL                                      0  $26     
         96        CONCAT                                           ~27     $26, '%0A'
         97        ECHO                                                     ~27
         98      > RETURN                                                   1

Function terminal_table:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 11
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/66ntp
function name:  terminal_table
number of ops:  19
compiled vars:  !0 = $col1, !1 = $col2, !2 = $max_num_spaces_between_columns, !3 = $num_spaces
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    5     3        INIT_FCALL                                               'mb_strlen'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $4      
          6        SUB                                              ~5      !2, $4
          7        ASSIGN                                                   !3, ~5
    7     8        IS_SMALLER_OR_EQUAL                                      !3, 0
          9      > JMPZ                                                     ~7, ->11
    8    10    >   ASSIGN                                                   !3, 1
   10    11    >   INIT_FCALL                                               'str_repeat'
         12        SEND_VAL                                                 '+'
         13        SEND_VAR                                                 !3
         14        DO_ICALL                                         $9      
         15        CONCAT                                           ~10     !0, $9
         16        CONCAT                                           ~11     ~10, !1
         17      > RETURN                                                   ~11
   11    18*     > RETURN                                                   null

End of function terminal_table

Function tabify:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 6
Branch analysis from position: 10
Branch analysis from position: 6
filename:       /in/66ntp
function name:  tabify
number of ops:  14
compiled vars:  !0 = $col1, !1 = $col2, !2 = $numTabs, !3 = $tabs, !4 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   24     3        ASSIGN                                                   !3, ''
   25     4        ASSIGN                                                   !4, 0
          5      > JMP                                                      ->8
   26     6    >   ASSIGN_OP                                     8          !3, '%09'
   25     7        PRE_INC                                                  !4
          8    >   IS_SMALLER                                               !4, !2
          9      > JMPNZ                                                    ~9, ->6
   28    10    >   CONCAT                                           ~10     !0, !3
         11        CONCAT                                           ~11     ~10, !1
         12      > RETURN                                                   ~11
   29    13*     > RETURN                                                   null

End of function tabify

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.7 ms | 1411 KiB | 31 Q