Skip to content

Instantly share code, notes, and snippets.

@simme
Created October 13, 2010 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save simme/624063 to your computer and use it in GitHub Desktop.
Save simme/624063 to your computer and use it in GitHub Desktop.
<?php
// One liner to kill the bastards.
preg_replace('/\s(?!.*\s)/', '&nbsp;', $string);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment