3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "B̮͖̭̻̰̙͇͔͚̓ͩ̐͂ͦO̵̦̪͈̙̠̪̾̇̿F̟̥̤͉̄̅̿̆̈̚̚H̵̱͕͈͉͒̉̈́͞ͅ"; $i = IntlBreakIterator::createCharacterInstance('en_CA'); $i->setText($str); var_dump($str, bin2hex($str)); echo PHP_EOL; $last = $i->current(); while( ($pos = $i->next()) >= 0) { $glyph = substr($str, $last, $pos - $last); var_dump($last, $pos, $glyph, bin2hex($glyph)); echo PHP_EOL; $last = $pos; }
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.4, 8.3.6 - 8.3.7
string(96) "B̮͖̭̻̰̙͇͔͚̓ͩ̐͂ͦO̵̦̪͈̙̠̪̾̇̿F̟̥̤͉̄̅̿̆̈̚̚H̵̱͕͈͉͒̉̈́͞ͅ" string(192) "42ccaecd96ccadccbbccb0cc99cd87cd94cd9acc93cda9cc90cd82cda64fccb5cca6ccaacd88cc99cca0ccaaccbecc87ccbf46cc9fcca5cca4cd89cc84cc85ccbfcc86cc88cc9acc9a48ccb5ccb1cd95cd88cd89cd92cc89cc88cc81cd9ecd85" int(0) int(29) string(29) "B̮͖̭̻̰̙͇͔͚̓ͩ̐͂ͦ" string(58) "42ccaecd96ccadccbbccb0cc99cd87cd94cd9acc93cda9cc90cd82cda6" int(29) int(50) string(21) "O̵̦̪͈̙̠̪̾̇̿" string(42) "4fccb5cca6ccaacd88cc99cca0ccaaccbecc87ccbf" int(50) int(73) string(23) "F̟̥̤͉̄̅̿̆̈̚̚" string(46) "46cc9fcca5cca4cd89cc84cc85ccbfcc86cc88cc9acc9a" int(73) int(96) string(23) "H̵̱͕͈͉͒̉̈́͞ͅ" string(46) "48ccb5ccb1cd95cd88cd89cd92cc89cc88cc81cd9ecd85"
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(96) "B̮͖̭̻̰̙͇͔͚̓ͩ̐͂ͦO̵̦̪͈̙̠̪̾̇̿F̟̥̤͉̄̅̿̆̈̚̚H̵̱͕͈͉͒̉̈́͞ͅ" string(192) "42ccaecd96ccadccbbccb0cc99cd87cd94cd9acc93cda9cc90cd82cda64fccb5cca6ccaacd88cc99cca0ccaaccbecc87ccbf46cc9fcca5cca4cd89cc84cc85ccbfcc86cc88cc9acc9a48ccb5ccb1cd95cd88cd89cd92cc89cc88cc81cd9ecd85" int(0) int(29) string(29) "B̮͖̭̻̰̙͇͔͚̓ͩ̐͂ͦ" string(58) "42ccaecd96ccadccbbccb0cc99cd87cd94cd9acc93cda9cc90cd82cda6" int(29) int(50) string(21) "O̵̦̪͈̙̠̪̾̇̿" string(42) "4fccb5cca6ccaacd88cc99cca0ccaaccbecc87ccbf" int(50) int(73) string(23) "F̟̥̤͉̄̅̿̆̈̚̚" string(46) "46cc9fcca5cca4cd89cc84cc85ccbfcc86cc88cc9acc9a" int(73) int(96) string(23) "H̵̱͕͈͉͒̉̈́͞ͅ" string(46) "48ccb5ccb1cd95cd88cd89cd92cc89cc88cc81cd9ecd85"
Output for 8.0.13
Fatal error: Uncaught Error: Class "IntlBreakIterator" not found in /in/07tRP:5 Stack trace: #0 {main} thrown in /in/07tRP on line 5
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Fatal error: Uncaught Error: Class 'IntlBreakIterator' not found in /in/07tRP:5 Stack trace: #0 {main} thrown in /in/07tRP on line 5
Process exited with code 255.

preferences:
213.48 ms | 402 KiB | 289 Q