<?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);
string(24) "m lorem Alice lorem lore"
int(14)
string(24) "lorem Alice lorem lorem "
int(14)
string(24) "lorem Alice lorem lorem "
int(14)
Output for 8.3.5
Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
string(24) "m lorem Alice lorem lore"
int(14)
string(24) "lorem Alice lorem lorem "
int(14)
string(24) "lorem Alice lorem lorem "
int(14)