PHP remove all spaces

不言
Release: 2023-03-23 22:22:01
Original
7446 people have browsed it

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)
Copy after login

2. Remove all spaces by regular matching

preg_replace('# #','',$goodid)
Copy after login
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!

Related labels:
php
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template