14,958
edits
| Line 469: | Line 469: | ||
# [https://en.wikipedia.org/wiki/Non-breaking_space Non-breaking space] ({{kbd | key=<nowiki>nbsp;</nowiki>}}) Replace Non-breaking space with one whitespace using PHP: {{kbd | key=<nowiki>$result = str_replace("\xc2\xa0", ' ', $original_string);</nowiki>}}<ref>[https://stackoverflow.com/questions/40724543/how-to-replace-decoded-non-breakable-space-nbsp php - How to replace decoded Non-breakable space (nbsp) - Stack Overflow]</ref> | # [https://en.wikipedia.org/wiki/Non-breaking_space Non-breaking space] ({{kbd | key=<nowiki>nbsp;</nowiki>}}) Replace Non-breaking space with one whitespace using PHP: {{kbd | key=<nowiki>$result = str_replace("\xc2\xa0", ' ', $original_string);</nowiki>}}<ref>[https://stackoverflow.com/questions/40724543/how-to-replace-decoded-non-breakable-space-nbsp php - How to replace decoded Non-breakable space (nbsp) - Stack Overflow]</ref> | ||
How to display the Non-breaking space? In MySQL | How to display the Non-breaking space In PHP? | ||
<pre> | |||
$input = '12345678' . hex2bin('c2a0'); | |||
echo $input . PHP_EOL; | |||
## Result of above script: '12345678 ' (one whitespace at the end) | |||
echo bin2hex($input) . PHP_EOL; | |||
## Result of above script: 3132333435363738c2a0 | |||
echo bin2hex('12345678') . PHP_EOL; | |||
## Result of above script: 3132333435363738 (You mat notice the difference of query result is C2A0) | |||
</pre> | |||
How to display the Non-breaking space In MySQL? | |||
<pre> | <pre> | ||
SELECT CONCAT('12345678', UNHEX('C2A0')) | SELECT CONCAT('12345678', UNHEX('C2A0')) | ||