Page 1 of 1
"$" in a string
Posted: Tue Aug 07, 2007 9:31 pm
by jkashu
I know this is something really easy that I'm forgetting, but how do I use a $ in a string without it being read as a variable?
<?
$var = "<? $page = gallery.php; ?>";
?>
The $var needs to be exactly what's in there without replacing the $page with something else.
Thanks!
Posted: Tue Aug 07, 2007 9:32 pm
by John Cartwright
Use single quotes
Posted: Tue Aug 07, 2007 9:32 pm
by VladSun
Single quotes?
Posted: Tue Aug 07, 2007 9:46 pm
by John Cartwright
VladSun wrote:Single quotes?
Are you refering to my reply or the question?
Posted: Tue Aug 07, 2007 9:48 pm
by VladSun
Jcart PostPosted: Tue Aug 07, 2007 9:32 pm
VladSun PostPosted: Tue Aug 07, 2007 9:32 pm

Reply to the OP
Posted: Tue Aug 07, 2007 9:49 pm
by John Cartwright
VladSun wrote:Jcart PostPosted: Tue Aug 07, 2007 9:32 pm
VladSun PostPosted: Tue Aug 07, 2007 9:32 pm

Reply to the OP
Never know.. maybe you are quick on the draw?

Posted: Tue Aug 07, 2007 9:55 pm
by VladSun
It is obvious that you were quicker ... this time

Re: "$" in a string
Posted: Wed Aug 08, 2007 6:57 am
by ghadacr
Code: Select all
$page = "gallery.php";
$var = '$page';
Posted: Wed Aug 08, 2007 8:24 am
by superdezign
You can also escape the character.