3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str1 = "— lorem lorem Alice lorem lorem lorem loremlorem"; // | < Why would a dash make a difference in the the found index? $str2 = "a lorem lorem Alice lorem lorem lorem loremlorem"; $str3 = " lorem lorem Alice lorem lorem lorem loremlorem"; // The found index is always the same $foundIndex = mb_stripos($str1, "Alice"); var_dump(substr($str1, $foundIndex - 6, 24), $foundIndex); $foundIndex = mb_stripos($str2, "Alice"); var_dump(substr($str2, $foundIndex - 6, 24), $foundIndex); $foundIndex = mb_stripos($str3, "Alice"); var_dump(substr($str3, $foundIndex - 6, 24), $foundIndex);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/alaWY
function name:  (null)
number of ops:  49
compiled vars:  !0 = $str1, !1 = $str2, !2 = $str3, !3 = $foundIndex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%E2%80%94+lorem+lorem+Alice+lorem+lorem+lorem+loremlorem'
    4     1        ASSIGN                                                   !1, 'a+lorem+lorem+Alice+lorem+lorem+lorem+loremlorem'
    5     2        ASSIGN                                                   !2, '++lorem+lorem+Alice+lorem+lorem+lorem+loremlorem'
    9     3        INIT_FCALL                                               'mb_stripos'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 'Alice'
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !3, $7
   10     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        SUB                                              ~9      !3, 6
         12        SEND_VAL                                                 ~9
         13        SEND_VAL                                                 24
         14        DO_ICALL                                         $10     
         15        SEND_VAR                                                 $10
         16        SEND_VAR                                                 !3
         17        DO_ICALL                                                 
   12    18        INIT_FCALL                                               'mb_stripos'
         19        SEND_VAR                                                 !1
         20        SEND_VAL                                                 'Alice'
         21        DO_ICALL                                         $12     
         22        ASSIGN                                                   !3, $12
   13    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'substr'
         25        SEND_VAR                                                 !1
         26        SUB                                              ~14     !3, 6
         27        SEND_VAL                                                 ~14
         28        SEND_VAL                                                 24
         29        DO_ICALL                                         $15     
         30        SEND_VAR                                                 $15
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                                 
   15    33        INIT_FCALL                                               'mb_stripos'
         34        SEND_VAR                                                 !2
         35        SEND_VAL                                                 'Alice'
         36        DO_ICALL                                         $17     
         37        ASSIGN                                                   !3, $17
   16    38        INIT_FCALL                                               'var_dump'
         39        INIT_FCALL                                               'substr'
         40        SEND_VAR                                                 !2
         41        SUB                                              ~19     !3, 6
         42        SEND_VAL                                                 ~19
         43        SEND_VAL                                                 24
         44        DO_ICALL                                         $20     
         45        SEND_VAR                                                 $20
         46        SEND_VAR                                                 !3
         47        DO_ICALL                                                 
         48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.54 ms | 1400 KiB | 19 Q