Page 1 of 1
Can't put <> in variable?
Posted: Tue Jul 20, 2010 8:28 pm
by signature16
Code: Select all
$email2 = "email@domain.com <FirstName LastName>";
I am trying to get this variable to have the email and name contents as show above.. but when i echo the variable out the stuff inside the side brackets is screwed up.
How can I get that into a variable?
Re: Can't put <> in variable?
Posted: Tue Jul 20, 2010 8:43 pm
by kurbot
try:
Code: Select all
$email2 = 'email@domain.com <FirstName LastName>';
echo htmlentities($email2);
if your just trying to display it visually
Re: Can't put <> in variable?
Posted: Tue Jul 20, 2010 8:54 pm
by whizzopia
'Less than' and 'greater than' sign are used to identify html tags.
If you see the html source in the browser, you will see that <> is actually there.
So, you have to convert < to < and > to >.
You can use htmlentities() function to convert them.
Re: Can't put <> in variable?
Posted: Tue Jul 20, 2010 10:01 pm
by signature16
I am not trying to print that out. I'm trying to make a link to be used in curl which needs that formating I believe.
Re: Can't put <> in variable?
Posted: Tue Jul 20, 2010 10:05 pm
by kurbot
if your passing the variable to Curl, then what you have already is fine.. if your trying to echo it to the screen then reference the htmlentities