PHP Basics : Removing White Space / HTML Tags From A String

Hey Wuup readers. I’ve got a simple post here for those learning PHP, or even the more seasoned programmer. If you’re looking for a simple way to to remove white space from strings, and strip html tags from strings too, try this out. It can be handy if you don’t want people to abuse a form or field in an application:

<?php

$example = " test  ff       1  <br > </p> hi     ";

$result = rtrim($example);

echo trim(strip_tags($result));

?>

No Comments

Trackbacks/Pingbacks

  1. PHP Basics : Removing White Space / HTML Tags From A String | Wuup - [...] the rest here: PHP Basics : Removing White Space / HTML Tags From A String | Wuup ...
  2. . o O ( Simple PHP Reviewed: Scam or Serious? ) - [...] may also want to check out: PHP Basics : Removing White Space / HTML Tags From A String | ...

Leave a Reply