3v4l.org

run code in 500+ PHP versions simultaneously
<?php use function PHPStan\dumpType; use function PHPStan\Testing\assertType; function doFoo(string $namespace):void { if (substr($namespace, 0, 4) === 'hello-world') {var_dump(__LINE__);} if ('hello-world' === substr($namespace, 0, 4)) {var_dump(__LINE__);} if (substr($namespace, 0, 13) === 'hello-world') {var_dump(__LINE__);} if ('hello-world' === substr($namespace, 0, 13)) {var_dump(__LINE__);} if (substr($namespace, 0, 11) === 'hello-world') {var_dump(__LINE__);} if ('hello-world' === substr($namespace, 0, 11)) {var_dump(__LINE__);} } doFoo('hello-world'); var_dump('--'); doFoo('abc'); var_dump('--'); doFoo('hello-world-in-php');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lKEen
function name:  (null)
number of ops:  16
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                                   'dofoo'
          1        SEND_VAL                                                     'hello-world'
          2        DO_FCALL                                          0          
   18     3        INIT_FCALL                                                   'var_dump'
          4        SEND_VAL                                                     '--'
          5        DO_ICALL                                                     
   19     6        INIT_FCALL                                                   'dofoo'
          7        SEND_VAL                                                     'abc'
          8        DO_FCALL                                          0          
   20     9        INIT_FCALL                                                   'var_dump'
         10        SEND_VAL                                                     '--'
         11        DO_ICALL                                                     
   21    12        INIT_FCALL                                                   'dofoo'
         13        SEND_VAL                                                     'hello-world-in-php'
         14        DO_FCALL                                          0          
         15      > RETURN                                                       1

Function dofoo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 15
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 22
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 29
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 43
Branch analysis from position: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
Branch analysis from position: 36
Branch analysis from position: 29
Branch analysis from position: 22
Branch analysis from position: 15
Branch analysis from position: 8
filename:       /in/lKEen
function name:  doFoo
number of ops:  44
compiled vars:  !0 = $namespace
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    6     0  E >   RECV                                                 !0      
    7     1        FRAMELESS_ICALL_3                substr              ~1      !0, 0
          2        OP_DATA                                                      4
          3        IS_IDENTICAL                                                 ~1, 'hello-world'
          4      > JMPZ                                                         ~2, ->8
          5    >   INIT_FCALL                                                   'var_dump'
          6        SEND_VAL                                                     7
          7        DO_ICALL                                                     
    8     8    >   FRAMELESS_ICALL_3                substr              ~4      !0, 0
          9        OP_DATA                                                      4
         10        IS_IDENTICAL                                                 ~4, 'hello-world'
         11      > JMPZ                                                         ~5, ->15
         12    >   INIT_FCALL                                                   'var_dump'
         13        SEND_VAL                                                     8
         14        DO_ICALL                                                     
   10    15    >   FRAMELESS_ICALL_3                substr              ~7      !0, 0
         16        OP_DATA                                                      13
         17        IS_IDENTICAL                                                 ~7, 'hello-world'
         18      > JMPZ                                                         ~8, ->22
         19    >   INIT_FCALL                                                   'var_dump'
         20        SEND_VAL                                                     10
         21        DO_ICALL                                                     
   11    22    >   FRAMELESS_ICALL_3                substr              ~10     !0, 0
         23        OP_DATA                                                      13
         24        IS_IDENTICAL                                                 ~10, 'hello-world'
         25      > JMPZ                                                         ~11, ->29
         26    >   INIT_FCALL                                                   'var_dump'
         27        SEND_VAL                                                     11
         28        DO_ICALL                                                     
   13    29    >   FRAMELESS_ICALL_3                substr              ~13     !0, 0
         30        OP_DATA                                                      11
         31        IS_IDENTICAL                                                 ~13, 'hello-world'
         32      > JMPZ                                                         ~14, ->36
         33    >   INIT_FCALL                                                   'var_dump'
         34        SEND_VAL                                                     13
         35        DO_ICALL                                                     
   14    36    >   FRAMELESS_ICALL_3                substr              ~16     !0, 0
         37        OP_DATA                                                      11
         38        IS_IDENTICAL                                                 ~16, 'hello-world'
         39      > JMPZ                                                         ~17, ->43
         40    >   INIT_FCALL                                                   'var_dump'
         41        SEND_VAL                                                     14
         42        DO_ICALL                                                     
   15    43    > > RETURN                                                       null

End of function dofoo

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
131.15 ms | 485 KiB | 11 Q