How do I replace tabs with spaces within variables in PHP? -


$ data has tabs, top positions and multiple locations. Want to replace several spaces with a single space, and remove the leading spaces.

Any such thing that will close this input data:

  [asdf asdf asdf asdf]  

output data In:

  [asdf asdf asdf asdf]  

How do I do this?

  $ data = trim (preg_replace ('/ \ s + / g', '' , $ Data));  

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -