3v4l.org

run code in 300+ PHP versions simultaneously
<?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','UTF-8').' '.'mb_strpos finds HERE at: '.mb_strpos($a_non_multibyte_str_same_length,'HERE','UTF-8');
Output for git.master, git.master_jit, rfc.property-hooks
strpos finds HERE at: 12 strpos finds HERE at: 9 Fatal error: Uncaught TypeError: mb_strpos(): Argument #3 ($offset) must be of type int, string given in /in/Pu9rE:12 Stack trace: #0 /in/Pu9rE(12): mb_strpos('\xC8\x9Bat\xC4\x83 \xC3\xAEn HER...', 'HERE', 'UTF-8') #1 {main} thrown in /in/Pu9rE on line 12
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
41.01 ms | 401 KiB | 8 Q