Home > Article > Backend Development > PHP remove all spaces
The content of this article is about removing all spaces in PHP, which has certain reference value. Now I share it with you. Friends in need can refer to it
Recommended Manual: php Complete Self-Study Manual
1. Remove spaces on both sides
trim($arr)
2. Remove all spaces by regular matching
preg_replace('# #','',$goodid)
Recommended related articles:
1.How to replace spaces in PHP (code)
2.How to filter spaces in PHP strings
Related video recommendations:
1.Dugu Jiujian(4)_PHP video tutorial
The above is the detailed content of PHP remove all spaces. For more information, please follow other related articles on the PHP Chinese website!