how to trim spances from a string in php code example
Example 1: remove every whitespace php
$string = preg_replace('/\s+/', '', $string);
Example 2: remove all spaces php
$string = "this is my string"
$string = preg_replace('/\s+/', '', $string);