3v4l.org

run code in 300+ PHP versions simultaneously
<?php $word = "Capuaalo"; $length = count($word); $count = 0; for($i = 0; $i < $length; $i++) { if($search = substr($word, $i, 1)=="a"){ $count = $count + 1; } } echo $length; echo substr($word, 0, 1); echo $count; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 6
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 6
Branch analysis from position: 19
Branch analysis from position: 6
Branch analysis from position: 16
filename:       /in/RTsv5
function name:  (null)
number of ops:  28
compiled vars:  !0 = $word, !1 = $length, !2 = $count, !3 = $i, !4 = $search
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Capuaalo'
    3     1        COUNT                                            ~6      !0
          2        ASSIGN                                                   !1, ~6
    4     3        ASSIGN                                                   !2, 0
    5     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->17
    6     6    >   INIT_FCALL                                               'substr'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !3
          9        SEND_VAL                                                 1
         10        DO_ICALL                                         $10     
         11        IS_EQUAL                                         ~11     $10, 'a'
         12        ASSIGN                                           ~12     !4, ~11
         13      > JMPZ                                                     ~12, ->16
    7    14    >   ADD                                              ~13     !2, 1
         15        ASSIGN                                                   !2, ~13
    5    16    >   PRE_INC                                                  !3
         17    >   IS_SMALLER                                               !3, !1
         18      > JMPNZ                                                    ~16, ->6
   10    19    >   ECHO                                                     !1
   11    20        INIT_FCALL                                               'substr'
         21        SEND_VAR                                                 !0
         22        SEND_VAL                                                 0
         23        SEND_VAL                                                 1
         24        DO_ICALL                                         $17     
         25        ECHO                                                     $17
   12    26        ECHO                                                     !2
   13    27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.87 ms | 1388 KiB | 15 Q