3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $original_multibyte_string = 'țată în HERE'; $a_non_multibyte_str_same_length = '123456789HERE'; // HERE is on 10th (9th element) character echo 'strpos finds HERE at: '.strpos($original_multibyte_string,'HERE').' '.'strpos finds HERE at: '.strpos($a_non_multibyte_str_same_length,'HERE'); // OUTPUTS: strpos finds HERE at: 12 mb_strpos finds HERE at: 9 echo "\n"; // now lets test the multibyte: echo 'mb_strpos finds HERE at: '.mb_strpos($original_multibyte_string,'HERE',0,'UTF-8').' '.'mb_strpos finds HERE at: '.mb_strpos($a_non_multibyte_str_same_length,'HERE',0,'UTF-8');
based on Pu9rE
Output for 4.3.0 - 7.2.0
strpos finds HERE at: 12 strpos finds HERE at: 9 mb_strpos finds HERE at: 9 mb_strpos finds HERE at: 9