3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($str, $substr) { return strpos(substr($str,1), $substr) === 0; } function test2($str, $substr) { return strpos($str, $substr) > 0; } $str = 'hello'; $sub = 'he'; var_dump( test($str, $sub), test2($str, $sub) ); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jg0Pq
function name:  (null)
number of ops:  15
compiled vars:  !0 = $str, !1 = $sub
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 'hello'
   11     1        ASSIGN                                                   !1, 'he'
   13     2        INIT_FCALL                                               'var_dump'
   14     3        INIT_FCALL                                               'test'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
   15     8        INIT_FCALL                                               'test2'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
   17    14      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jg0Pq
function name:  test
number of ops:  13
compiled vars:  !0 = $str, !1 = $substr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    3     2        INIT_FCALL                                               'strpos'
          3        INIT_FCALL                                               'substr'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $2      
          7        SEND_VAR                                                 $2
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $3      
         10        IS_IDENTICAL                                     ~4      $3, 0
         11      > RETURN                                                   ~4
    4    12*     > RETURN                                                   null

End of function test

Function test2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jg0Pq
function name:  test2
number of ops:  9
compiled vars:  !0 = $str, !1 = $substr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'strpos'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6        IS_SMALLER                                       ~3      0, $2
          7      > RETURN                                                   ~3
    8     8*     > RETURN                                                   null

End of function test2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.92 ms | 1402 KiB | 22 Q