3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo($ar_holding, $starts_with) { $count = 0; foreach ($ar_holding as $v) { if (strpos($v, $starts_with)===0) { ++$count; } } return $count; } $ar_holding = array('usa-ny-nyc','usa-fl-ftl', 'usa-nj-hb', 'usa-ny-wch', 'usa-ny-li'); echo foo($ar_holding, "usa-ny-");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5Lq3Y
function name:  (null)
number of ops:  7
compiled vars:  !0 = $ar_holding
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   ASSIGN                                                       !0, <array>
   14     1        INIT_FCALL                                                   'foo'
          2        SEND_VAR                                                     !0
          3        SEND_VAL                                                     'usa-ny-'
          4        DO_FCALL                                          0  $2      
          5        ECHO                                                         $2
          6      > RETURN                                                       1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 10
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 9
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
filename:       /in/5Lq3Y
function name:  foo
number of ops:  13
compiled vars:  !0 = $ar_holding, !1 = $starts_with, !2 = $count, !3 = $v
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    3     2        ASSIGN                                                       !2, 0
    4     3      > FE_RESET_R                                           $5      !0, ->10
          4    > > FE_FETCH_R                                                   $5, !3, ->10
    5     5    >   FRAMELESS_ICALL_2                strpos              ~6      !3, !1
          6        IS_IDENTICAL                                                 ~6, 0
          7      > JMPZ                                                         ~7, ->9
    6     8    >   PRE_INC                                                      !2
    4     9    > > JMP                                                          ->4
         10    >   FE_FREE                                                      $5
    9    11      > RETURN                                                       !2
   10    12*     > RETURN                                                       null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
160.19 ms | 2243 KiB | 14 Q