3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripSpecialCharater($string) { return preg_replace(['/\s{2,}|[\t\R]/u', '/[^a-z\d\s&‚~§©ÂÃ⃀-]/ui'], [' ', ''], $string); //$string = iconv("Windows-1252","UTF-8",urldecode($string)); //$string = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $string); //return preg_replace('/[^a-zA-Z0-9ç&-©‚ƒ‘\s]/', '', $string); } $tests = ['12 34', 'adsf', 'co©', 'pound £']; foreach ($tests as $test) { echo "$test : "; var_export(stripSpecialCharater($test)); echo "\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
12 34 : Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 11 in /in/VvVcc on line 4 NULL adsf : Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 11 in /in/VvVcc on line 4 NULL co© : Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 11 in /in/VvVcc on line 4 NULL pound £ : Warning: preg_replace(): Compilation failed: escape sequence is invalid in character class at offset 11 in /in/VvVcc on line 4 NULL

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:
62.49 ms | 402 KiB | 8 Q