In my default php installation the echo with double quotes ", does'nt work, and the variable names are not substituted
with their values within the string, but single quotes with catenation operator works.How do I fix this problem ?
Configuring PHP
Moderator: General Moderators
Re: Configuring PHP
By fixing your code. Because I guarantee you it's not quite what you've said it is.
Exactly what code isn't working?
Exactly what code isn't working?
Re: Configuring PHP
Here is my code, which I executed
$limit=5;
echo "<p> $limit </p>"; // This does'nt work
echo '<p>'.$limit.'</p>'; // This works
I had a whole web-page coded in double-quotes and it displayed blank;
but when I changed them all to single quotes the page is displaying properly.
$limit=5;
echo "<p> $limit </p>"; // This does'nt work
echo '<p>'.$limit.'</p>'; // This works
I had a whole web-page coded in double-quotes and it displayed blank;
but when I changed them all to single quotes the page is displaying properly.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: Configuring PHP
I have never heard of that happening. Does it happen on every page on this server? Or only on this page?
(#10850)
Re: Configuring PHP
Also, you're saying the output is blank. Is error reporting enabled? Anything in the logs?
Re: Configuring PHP
So if you execute that exact code, you getsundaresh wrote:Here is my code, which I executed
$limit=5;
echo "<p> $limit </p>"; // This does'nt work
echo '<p>'.$limit.'</p>'; // This works
I had a whole web-page coded in double-quotes and it displayed blank;
but when I changed them all to single quotes the page is displaying properly.
Code: Select all
<p> </p><p>5</p>Re: Configuring PHP
When I execute the first echo seperately I get a blank-page.
When I execute the second echo I get 5 displayed on my browser.
I have'nt tried executing php on the console so I do'nt know, the php output.But the final html file is a blank when
I seperately use the first echo and the html is alright when I use the second format of echo.
When I execute the second echo I get 5 displayed on my browser.
I have'nt tried executing php on the console so I do'nt know, the php output.But the final html file is a blank when
I seperately use the first echo and the html is alright when I use the second format of echo.
Re: Configuring PHP
So how about copy/pasting the entire, unaltered, exact contents of the file you are executing that contains both the working and not-working examples? Then browse to the script, do a View Source, and copy/paste the entire, unaltered, exact HTML you see.