Page 1 of 1

Variable inside string

Posted: Thu Aug 12, 2004 3:20 am
by dwfait
would this work?

"news/$id.txt"

or would it come out as news/$id.txt?
If it does, how would i put the variable $id inside the string?

Posted: Thu Aug 12, 2004 3:29 am
by anjanesh

Code: Select all

<?php
$id="hello";
$a="news/$id.txt";
$b='news/$id.txt';
echo $id.'<br>'.$a.'<br>'.$b.'<br>';
?>
Returns :
hello
news/hello.txt
news/$id.txt

Posted: Thu Aug 12, 2004 3:49 am
by dwfait
thanks :)