Skip to content
No results
  • All articles
  • Showcase
  • About
  • Contact
draghici.net
  • All articles
  • Showcase
  • About
  • Contact
draghici.net

php remove extra spaces

  • Cristi DraghiciCristi Draghici
  • August 25, 2014
  • Programming

Removing multiple spaces inside a string can be done in PHP using some simple code:

preg_replace("/s+/", " ", $string);Code language: PHP (php)
Tags
# hidden# php
Previous Post Wordpress - make all images inside a post links
Next Post Set internal encoding to UTF-8 for php

Recently updated

  • Host old apps in containers with Debian 12
  • Setting up my new Raspberry Pi
  • How to test your frontend applications
  • Family tree – Genealogy application with React
  • Modernizing the internals of an old notes taking app

A quick note

I post here articles that I found interesting, solutions to problems I have encountered and last but not least, display information about my projects and achievements.

Categories

Everything else (85) Programming (177) Useful tools (23)

draghici.net © 2006 - 2025 - Most of the rights reserved