3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strpose($haystack, $needle, $offset = 0) { $found = preg_match( '(\b(?:'.preg_quote($needle).')\b)Su', $haystack, $match, PREG_OFFSET_CAPTURE, $offset ); return ($found) ? $match[0][1] : FALSE; } var_dump(strpose("Hello World", "ll")); var_dump(strpose("Hello World", "Hello")); var_dump(strpose("Hello Worlds", "World")); var_dump(strpose("Hello World", "World")); var_dump(strpose("Hello World", "Hello World"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b0BIZ
function name:  (null)
number of ops:  36
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'strpose'
          2        SEND_VAL                                                 'Hello+World'
          3        SEND_VAL                                                 'll'
          4        DO_FCALL                                      0  $0      
          5        SEND_VAR                                                 $0
          6        DO_ICALL                                                 
   15     7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'strpose'
          9        SEND_VAL                                                 'Hello+World'
         10        SEND_VAL                                                 'Hello'
         11        DO_FCALL                                      0  $2      
         12        SEND_VAR                                                 $2
         13        DO_ICALL                                                 
   16    14        INIT_FCALL                                               'var_dump'
         15        INIT_FCALL                                               'strpose'
         16        SEND_VAL                                                 'Hello+Worlds'
         17        SEND_VAL                                                 'World'
         18        DO_FCALL                                      0  $4      
         19        SEND_VAR                                                 $4
         20        DO_ICALL                                                 
   17    21        INIT_FCALL                                               'var_dump'
         22        INIT_FCALL                                               'strpose'
         23        SEND_VAL                                                 'Hello+World'
         24        SEND_VAL                                                 'World'
         25        DO_FCALL                                      0  $6      
         26        SEND_VAR                                                 $6
         27        DO_ICALL                                                 
   18    28        INIT_FCALL                                               'var_dump'
         29        INIT_FCALL                                               'strpose'
         30        SEND_VAL                                                 'Hello+World'
         31        SEND_VAL                                                 'Hello+World'
         32        DO_FCALL                                      0  $8      
         33        SEND_VAR                                                 $8
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Function strpose:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 21
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/b0BIZ
function name:  strpose
number of ops:  24
compiled vars:  !0 = $haystack, !1 = $needle, !2 = $offset, !3 = $found, !4 = $match
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      0
    4     3        INIT_FCALL                                               'preg_match'
    5     4        INIT_FCALL                                               'preg_quote'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $5      
          7        CONCAT                                           ~6      '%28%5Cb%28%3F%3A', $5
          8        CONCAT                                           ~7      ~6, '%29%5Cb%29Su'
          9        SEND_VAL                                                 ~7
    6    10        SEND_VAR                                                 !0
    7    11        SEND_REF                                                 !4
    8    12        SEND_VAL                                                 256
    9    13        SEND_VAR                                                 !2
         14        DO_ICALL                                         $8      
    4    15        ASSIGN                                                   !3, $8
   11    16      > JMPZ                                                     !3, ->21
         17    >   FETCH_DIM_R                                      ~10     !4, 0
         18        FETCH_DIM_R                                      ~11     ~10, 1
         19        QM_ASSIGN                                        ~12     ~11
         20      > JMP                                                      ->22
         21    >   QM_ASSIGN                                        ~12     <false>
         22    > > RETURN                                                   ~12
   12    23*     > RETURN                                                   null

End of function strpose

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.29 ms | 1403 KiB | 24 Q