3v4l.org

run code in 300+ PHP versions simultaneously
<?php function cascade(string $s, int $gap): string { $lines = []; $words = explode(' ', $s); foreach ($words as $word) { $line = ""; for ($i = 0; $i < strlen($word); $i++) { $line .= str_repeat('_', $gap * $i) . $word[$i] . PHP_EOL; } $lines[] = trim($line); // Remove the trailing newline character } return implode(PHP_EOL, $lines); } echo cascade('The codings bug', 2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q5k3X
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'cascade'
          1        SEND_VAL                                                 'The+codings+bug'
          2        SEND_VAL                                                 2
          3        DO_FCALL                                      0  $0      
          4        ECHO                                                     $0
          5      > RETURN                                                   1

Function cascade:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 32
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 32
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 13
Branch analysis from position: 26
Branch analysis from position: 13
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/Q5k3X
function name:  cascade
number of ops:  41
compiled vars:  !0 = $s, !1 = $gap, !2 = $lines, !3 = $words, !4 = $word, !5 = $line, !6 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        ASSIGN                                                   !2, <array>
    5     3        INIT_FCALL                                               'explode'
          4        SEND_VAL                                                 '+'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $8      
          7        ASSIGN                                                   !3, $8
    7     8      > FE_RESET_R                                       $10     !3, ->32
          9    > > FE_FETCH_R                                               $10, !4, ->32
    8    10    >   ASSIGN                                                   !5, ''
    9    11        ASSIGN                                                   !6, 0
         12      > JMP                                                      ->23
   10    13    >   INIT_FCALL                                               'str_repeat'
         14        SEND_VAL                                                 '_'
         15        MUL                                              ~13     !1, !6
         16        SEND_VAL                                                 ~13
         17        DO_ICALL                                         $14     
         18        FETCH_DIM_R                                      ~15     !4, !6
         19        CONCAT                                           ~16     $14, ~15
         20        CONCAT                                           ~17     ~16, '%0A'
         21        ASSIGN_OP                                     8          !5, ~17
    9    22        PRE_INC                                                  !6
         23    >   STRLEN                                           ~20     !4
         24        IS_SMALLER                                               !6, ~20
         25      > JMPNZ                                                    ~21, ->13
   12    26    >   INIT_FCALL                                               'trim'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                         $23     
         29        ASSIGN_DIM                                               !2
         30        OP_DATA                                                  $23
    7    31      > JMP                                                      ->9
         32    >   FE_FREE                                                  $10
   15    33        INIT_FCALL                                               'implode'
         34        SEND_VAL                                                 '%0A'
         35        SEND_VAR                                                 !2
         36        DO_ICALL                                         $24     
         37        VERIFY_RETURN_TYPE                                       $24
         38      > RETURN                                                   $24
   16    39*       VERIFY_RETURN_TYPE                                       
         40*     > RETURN                                                   null

End of function cascade

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.01 ms | 1021 KiB | 18 Q