Re: string concat with < and >
| From: | Matt McClanahan | Date: | Sun, 01 Oct 2000 00:27:12 +0000 |
| Subject: | Re: string concat with < and > | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-18176@lists.php.net to get a copy of this message | ||
On Sat, 30 Sep 2000, Remco Chang wrote:
> i'm having trouble concatenating strings with the characters '<' and
> '>'.
>
> $msg = "hello";
> $msg = "<".$msg.">";
>
> this doesn't work at all... i would like $msg to be <hello>, but i end up
> getting an empty string.
>
> neither does "<<".$msg.">>" or
> "\<".$msg."\>" work...
>
> i'm stumped, any ideas?
Works fine. But if you echo that to a browser, it'll parse <hello> as a
tag and display nothing. (Hint: Viewing the html source when debugging is
almost always useful)
If you want to display '<hello>' in a browser, you'd need to use < and
> instead of < and >.
$msg = 'hello';
$msg = "<$msg>";
Matt