1<?php
2$stripped = str_replace(' ', '', "10 1000 0000 000");
3echo $stripped;
1<?php
2$phone = preg_replace( '/\s+/', '', "01234 567890" );
3echo $phone;
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