3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Hello World";$spaceCount = substr_count($str, " "); $letterIndx = 0; // count number of spaces and then loop for($i=0; $i<=$spaceCount; $i++) { // get space positions $spaceIndx = strpos($str, " ", $letterIndx); // assign word by specifying start position and length if ($spaceIndx == 0) { $word = substr($str, $letterIndx); } else { $word = substr($str, $letterIndx, $spaceIndx - $letterIndx); } // push word into array $myArray[] = $word; // get first letter after space $letterIndx = $spaceIndx + 1; } // reverse the array $reverse = array_reverse($myArray); // echo it out foreach($reverse as $rev) { echo $rev." "; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
2 jumps found. (Code = 77) Position 1 = 42, Position 2 = 46
Branch analysis from position: 42
2 jumps found. (Code = 78) Position 1 = 43, Position 2 = 46
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
Branch analysis from position: 46
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 46
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
Branch analysis from position: 9
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 9
Branch analysis from position: 37
Branch analysis from position: 9
filename:       /in/ptAnu
function name:  (null)
number of ops:  48
compiled vars:  !0 = $str, !1 = $spaceCount, !2 = $letterIndx, !3 = $i, !4 = $spaceIndx, !5 = $word, !6 = $myArray, !7 = $reverse, !8 = $rev
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 'Hello+World'
          1        INIT_FCALL                                               'substr_count'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 '+'
          4        DO_ICALL                                         $10     
          5        ASSIGN                                                   !1, $10
    4     6        ASSIGN                                                   !2, 0
    7     7        ASSIGN                                                   !3, 0
          8      > JMP                                                      ->35
   10     9    >   INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 '+'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $14     
         14        ASSIGN                                                   !4, $14
   13    15        IS_EQUAL                                                 !4, 0
         16      > JMPZ                                                     ~16, ->23
   14    17    >   INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !0
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $17     
         21        ASSIGN                                                   !5, $17
         22      > JMP                                                      ->30
   16    23    >   INIT_FCALL                                               'substr'
         24        SEND_VAR                                                 !0
         25        SEND_VAR                                                 !2
         26        SUB                                              ~19     !4, !2
         27        SEND_VAL                                                 ~19
         28        DO_ICALL                                         $20     
         29        ASSIGN                                                   !5, $20
   20    30    >   ASSIGN_DIM                                               !6
         31        OP_DATA                                                  !5
   23    32        ADD                                              ~23     !4, 1
         33        ASSIGN                                                   !2, ~23
    7    34        PRE_INC                                                  !3
         35    >   IS_SMALLER_OR_EQUAL                                      !3, !1
         36      > JMPNZ                                                    ~26, ->9
   28    37    >   INIT_FCALL                                               'array_reverse'
         38        SEND_VAR                                                 !6
         39        DO_ICALL                                         $27     
         40        ASSIGN                                                   !7, $27
   31    41      > FE_RESET_R                                       $29     !7, ->46
         42    > > FE_FETCH_R                                               $29, !8, ->46
   32    43    >   CONCAT                                           ~30     !8, '+'
         44        ECHO                                                     ~30
   31    45      > JMP                                                      ->42
         46    >   FE_FREE                                                  $29
   35    47      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.25 ms | 1404 KiB | 21 Q