3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = html_entity_decode("&nbsp;"); print "The Problem: \n\n"; print ORD($string[0]); print "\n"; print ORD($string[1]); print "\n\n"; $string1 = str_replace("\u{c2a0}", "", $string); $string2 = preg_replace('/^(\\s|\\xC2\\xA0)+|(\\s|\\xC2\\xA0)+$/', '', $string); print "Mark Baker's Solution |" . $string1 . "|\n"; print "Codesmith's Solution |" . $string2 . "|\n";

preferences:
25.9 ms | 407 KiB | 5 Q