3v4l.org

run code in 300+ PHP versions simultaneously
<?php // words inside string with umlaute, later add http://zahnstocher47.de instead of "zahnstocher" as the correct solution $string = "apfelsaft siebenundvierzig zahnstocher gelb ethereum österreich"; // get length of string $l = mb_strlen($string); $chars = mb_str_split($string); $f = ''; // loop through length and output each letter by itself for ($i = 0; $i <= $l; $i++){ // umlaute buggy when there is a concatenation $f .= $chars[$i] . " "; } var_dump($f);
Output for 8.0.0 - 8.0.13, 8.1rc1 - rc3
Warning: Undefined array key 63 in /in/JIQoE on line 14 string(128) "a p f e l s a f t s i e b e n u n d v i e r z i g z a h n s t o c h e r g e l b e t h e r e u m ö s t e r r e i c h "
Output for 7.4.0 - 7.4.26
Notice: Undefined offset: 63 in /in/JIQoE on line 14 string(128) "a p f e l s a f t s i e b e n u n d v i e r z i g z a h n s t o c h e r g e l b e t h e r e u m ö s t e r r e i c h "
Output for 7.3.0 - 7.3.33
Fatal error: Uncaught Error: Call to undefined function mb_str_split() in /in/JIQoE:8 Stack trace: #0 {main} thrown in /in/JIQoE on line 8
Process exited with code 255.

preferences:
20.27 ms | 462 KiB | 5 Q