php – & sign is not echoed out-ThrowExceptions

Exception or error:

I have the following:

$A= Today-&-Tomorrow;

I want to echo out $A as follows:
Today & Tomorrow

I have tried this:

echo str_replace('-', ' ',$A)

This results in Today
it will NOT echo out & Tomorrow
I know the problem is the & sign however I do not know how to solve this I tried &
Any help welcome

How to solve:

Put single quotes for your $A as follows:

$A = 'Today-&-Tomorrow';
echo str_replace('-', ' ',$A); // outputs Today & Tomorrow 

Leave a Reply

Your email address will not be published. Required fields are marked *