Re: Cannot get this one correct and working, though simple!



Jerry Stuckle wrote:
> Geoff Berrow wrote:
>> Message-ID: <IU5yAgAsnQtDFw$+@xxxxxxxxxxxxxxxxxxx> from Peter Fox
>> contained the following:
>>
>>
>>>>But my problem is that part of the code ...<img src='thumb$i.jpg'> ...
>>>
>>>Single quotes! Try Double.
>>
>>
>> Single quotes are fine as is the code AFAICT.
>>
>
> No, with single quotes $i is not expanded. It would be with double quotes.

Single quotes *within* double quotes, as the OP had, do not stop PHP
from interpolating the variables!

Try it

<?php
$name = 'Jerry';

echo "Name is $name"; /* only double quotes */
echo 'Name is $name'; /* only single quotes */
echo "Name is '$name'"; /* single quotes *within* double quotes */
echo 'Name is "$name"'; /* double quotes *within* single quotes */
?>

--
Mail to my "From:" address is readable by all at http://www.dodgeit.com/
== ** ## !! ------------------------------------------------ !! ## ** ==
TEXT-ONLY mail to the whole "Reply-To:" address ("My Name" <my@address>)
may bypass my spam filter. If it does, I may reply from another address!
.



Relevant Pages

  • Re: nesting JS in echos
    ... html coder here, new and terrified * of php!! ... i'm trying to bury a JS script to rotate a photo, in a page i converted from html to php. ... thought I'd try integrating a tested and true JS image random rotator script into the echo command, but the problem was the syntax of the single quotes and double quotes needed in the doc.write and variable sequences in the JS. ...
    (comp.lang.php)
  • Re: nesting JS in echos
    ... html coder here, new and terrified * of php!! ... i'm trying to bury a JS script to rotate a photo, in a page i converted from html to php. ... thought I'd try integrating a tested and true JS image random rotator script into the echo command, but the problem was the syntax of the single quotes and double quotes needed in the doc.write and variable sequences in the JS. ...
    (comp.lang.php)
  • Re: PHP forms completely blank
    ... When I run the php script the resulting web page is blank. ... #check email useraddr field is not blank ... I use single quotes and it works fine on a Linux hosting service with Php5.0 ... nothing needs to be enabled to use the $_SERVER variables. ...
    (alt.php)
  • Re: nesting JS in echos
    ... html coder here, new and terrified * of php!! ... i'm trying to bury a JS script to rotate a photo, in a page i converted from html to php. ... thought I'd try integrating a tested and true JS image random rotator script into the echo command, but the problem was the syntax of the single quotes and double quotes needed in the doc.write and variable sequences in the JS. ...
    (comp.lang.php)
  • Re: PHP forms completely blank
    ... Jerry Stuckle wrote: ... When I run the php script the resulting web page is blank. ... #check email useraddr field is not blank ... I use single quotes and it works fine on a Linux hosting service with Php5.0 ...
    (alt.php)