Question and answer is powered by AnsPress.io
I used trim() function to remove space in php but it is not working.How to do this?
If you want to remove just spaces
use str_replace function. Like
$string_val=str_replace(‘ ‘,”,$string);
Or if you want to remove all white spaces then use preg_replace function
$string_val=preg_replace(‘/s+/’,”,$string);