php trim() not working to remove empty blank spaces
trim()
removes all the whitespaces from the beginning and end of a string and returns the trimmed string
So you'll need to feed the returned string of trim()
to empty()
:
<?php
$x = " ";
var_dump(empty($x)); // false
var_dump(trim($x)); // string(0) ""
var_dump(empty(trim($x))); // true