Home  >  Article  >  Backend Development  >  What are the functions for removing spaces in php?

What are the functions for removing spaces in php?

coldplay.xixi
coldplay.xixiOriginal
2020-10-05 14:20:393114browse

php functions to remove spaces include: 1. Function [trim($arr)] removes spaces on both sides; 2. Function [preg_replace()] regular matching to remove all spaces, the code is [preg_replace('# # ','',$goodid)].

What are the functions for removing spaces in php?

php functions to remove spaces are:

1. Remove spaces on both sides

  trim($arr)

2. Regular matching removes all spaces

  preg_replace('# #','',$goodid)

If you want to learn more about programming, please pay attention to the php training column!

The above is the detailed content of What are the functions for removing spaces in php?. 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