1<?php
2$stripped = str_replace(' ', '', "10 1000 0000 000");
3echo $stripped;
1phpCopy<?php
2$searchString = " ";
3$replaceString = "";
4$originalString = "This is a programming tutorial";
5
6$outputString = preg_replace('/\s+/', '', $originalString);
7echo("The original string is: $originalString \n");
8echo("The string without spaces is: $outputString \n");
9?>
10
1$words = ' my words ';
2$words = trim($words);
3var_dump($words);
4// string(8) "my words"
5