php trim all spaces in a string 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);
$string = preg_replace('/\s+/', '', $string);
$string = "this is my string"
$string = preg_replace('/\s+/', '', $string);