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
1phpCopy<?php
2$searchString = " ";
3$replaceString = "";
4$originalString = "This is a programming tutorial";
5
6$outputString = str_replace($searchString, $replaceString, $originalString);
7echo("The original string is: $originalString \n");
8echo("The string without spaces is: $outputString");
9
10?>
11