remove any spaces from string laravel code example
Example 1: remove empty spaces php
$string = str_replace(' ', '', $string);
Example 2: remove every whitespace php
$string = preg_replace('/\s+/', '', $string);
$string = str_replace(' ', '', $string);
$string = preg_replace('/\s+/', '', $string);