3v4l.org

run code in 500+ PHP versions simultaneously
<?php function findFirstOccurance($str){ $arr = explode(' ',$str); $counter = 0; foreach($arr as $value){ $counter=$counter+strlen($value); #echo $counter.PHP_EOL; if($value > 10000){ return $counter - 1; } } } $str = "20 plus 1000 is not 20000."; echo findFirstOccurance($str); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NNDZk
function name:  (null)
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                       !0, '20+plus+1000+is+not+20000.'
   14     1        INIT_FCALL                                                   'findfirstoccurance'
          2        SEND_VAR                                                     !0
          3        DO_FCALL                                          0  $2      
          4        ECHO                                                         $2
   15     5      > RETURN                                                       1

Function findfirstoccurance:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 18
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 17
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/NNDZk
function name:  findFirstOccurance
number of ops:  20
compiled vars:  !0 = $str, !1 = $arr, !2 = $counter, !3 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    3     1        INIT_FCALL                                                   'explode'
          2        SEND_VAL                                                     '+'
          3        SEND_VAR                                                     !0
          4        DO_ICALL                                             $4      
          5        ASSIGN                                                       !1, $4
    4     6        ASSIGN                                                       !2, 0
    5     7      > FE_RESET_R                                           $7      !1, ->18
          8    > > FE_FETCH_R                                                   $7, !3, ->18
    6     9    >   STRLEN                                               ~8      !3
         10        ADD                                                  ~9      !2, ~8
         11        ASSIGN                                                       !2, ~9
    8    12        IS_SMALLER                                                   10000, !3
         13      > JMPZ                                                         ~11, ->17
    9    14    >   SUB                                                  ~12     !2, 1
         15        FE_FREE                                                      $7
         16      > RETURN                                                       ~12
    5    17    > > JMP                                                          ->8
         18    >   FE_FREE                                                      $7
   12    19      > RETURN                                                       null

End of function findfirstoccurance

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
173.53 ms | 2028 KiB | 15 Q