3v4l.org

run code in 500+ 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:  40
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        SUB                                                  ~9      !3, 6
         10        FRAMELESS_ICALL_3                substr              ~10     !0, ~9
         11        OP_DATA                                                      24
         12        SEND_VAL                                                     ~10
         13        SEND_VAR                                                     !3
         14        DO_ICALL                                                     
   12    15        INIT_FCALL                                                   'mb_stripos'
         16        SEND_VAR                                                     !1
         17        SEND_VAL                                                     'Alice'
         18        DO_ICALL                                             $12     
         19        ASSIGN                                                       !3, $12
   13    20        INIT_FCALL                                                   'var_dump'
         21        SUB                                                  ~14     !3, 6
         22        FRAMELESS_ICALL_3                substr              ~15     !1, ~14
         23        OP_DATA                                                      24
         24        SEND_VAL                                                     ~15
         25        SEND_VAR                                                     !3
         26        DO_ICALL                                                     
   15    27        INIT_FCALL                                                   'mb_stripos'
         28        SEND_VAR                                                     !2
         29        SEND_VAL                                                     'Alice'
         30        DO_ICALL                                             $17     
         31        ASSIGN                                                       !3, $17
   16    32        INIT_FCALL                                                   'var_dump'
         33        SUB                                                  ~19     !3, 6
         34        FRAMELESS_ICALL_3                substr              ~20     !2, ~19
         35        OP_DATA                                                      24
         36        SEND_VAL                                                     ~20
         37        SEND_VAR                                                     !3
         38        DO_ICALL                                                     
         39      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
151.45 ms | 1457 KiB | 10 Q