I am developing a website in PHP. In it, I am saving the images in a folder on a server.
I accept a name from user and want to use that name as the image name. Sometimes the user enters a name like two words.
So I want to remove the space between two words. For example, if the user enters as 'Paneer Pakoda dish', I want to convert it like 'PaneerPakodaDish'.
How can I do that?
I used
1) str_replace(' ', '', $str);
2) preg_replace(' ', '', $str);
3) trim($str, ' ');
But these are not giving the output as I required.