remove all spaces php string code example
Example 1: remove empty spaces php
$string = str_replace(' ', '', $string);
Example 2: remove spaces from string php
<?php
$phone = preg_replace( '/\s+/', '', "01234 567890" );
echo $phone;
$string = str_replace(' ', '', $string);
<?php
$phone = preg_replace( '/\s+/', '', "01234 567890" );
echo $phone;