Удалить пространство из строки PHP
<?php
$stripped = str_replace(' ', '', "10 1000 0000 000");
echo $stripped;
Unusual Unicorn
<?php
$stripped = str_replace(' ', '', "10 1000 0000 000");
echo $stripped;
<?php
$phone = preg_replace( '/\s+/', '', "01234 567890" );
echo $phone;
$words = ' my words ';
$words = trim($words);
var_dump($words);
// string(8) "my words"
$trimmed = trim($text);
var_dump($trimmed);