Using PHP, how can I echo an at (@)
sign?
Ultimately, I'm trying to print out an e-mail address to a shell, that should look like this: 'user@site.com'
, but it ends up looking like this: 'usersite.com'
.
I see that all these (echo, exec, shell_exec, sprintf, vsprintf) behave like this so I suspect I need to escape it in some way?
I think you are doing something wrong, there is no escaping neccessary:
echo "user@site.com";
When echoing to shell, you need to use double quotes if you are using any special characters, @ included.
This will work:
echo "user@site.com/n";
This will not:
echo 'user@site.com/n';