Home  >  Article  >  Backend Development  >  PHP remove all spaces

PHP remove all spaces

不言
不言Original
2018-04-16 10:58:177440browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn