php replace multiple spaces end chrters to one code example
Example 1: php replace two spaces with one
$output = preg_replace('!\s+!', ' ', $input);
Example 2: remove double space php
$ro = preg_replace('/\s+/', ' ',$row['message']);
Example 3: php replace multiple spaces end chrters to one
$string = preg_replace('/[\s$@_*]+/', '_', $string);