@ 2025-03-05T13:39:15Z <?php
$str = "helloworld";
echo preg_replace('~.\L.~', ' ', $str);
echo "\n---\n";
echo array_reduce(str_split($str, 2), function($carry, $item) {
return $carry . $item[0] . (isset($item[1]) ? ' ' : '');
});
echo "\n---\n";
for ($offset = 1, $length = strlen($str); $offset < $length; $offset += 2) {
$str[$offset] = ' ';
}
echo $str;
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.2.0 - 8.2.28 , 8.3.0 - 8.3.19 , 8.4.1 - 8.4.5 Warning: preg_replace(): Compilation failed: PCRE2 does not support \F, \L, \l, \N{name}, \U, or \u at offset 3 in /in/JuJkJ on line 5
---
h l o o l
---
h l o o l preferences:dark mode live preview ace vim emacs key bindings
61.39 ms | 406 KiB | 5 Q