Joseph,

> And I have had to take more quotes away!

PHP's quote handling is a bit strange and can take some getting to grips
with :-)

Strings inside double quotes are parsed, meaning you can do this sort of
thing:

  // my pet is a cat
  $pet = "cat";
  echo "my pet is a $pet.";

Strings inside single quotes aren't parsed, so you can do this:

  // my pet is a $pet
  $pet = "cat";
  echo 'my pet is a $pet.';

If you want to show the variable, you have to concatenate it:

  // my pet is a cat
  $pet = "cat";
  echo 'my pet is a '. $pet;

This extends to pretty much everything:

  // new
  // line
  echo "new\nline";

  // new\nline
  echo 'new\nline';

Single quotes are a *tiny* bit faster, but the big advantage of using them
is that you don't end up with messy escape characters. For example:

  echo "<table width=\"100%\" cellpadding=\"0\" border=\"0\">";

To stop the PHP interpreter thinking your echo statement ends at any of the
quotes in the HTML, you have to escape them with the backslash.

If you use single quotes you sidestep this neatly:

  echo '<table width="100%" cellpadding="0" border="0">';

When you're accessing arrays you can use either, but again single quotes
will be slightly faster:

  // either of these will work
  $foo = $bar["baz"];
  $foo = $bar['baz'];

Just to through a spanner in the works, there are some constants that will
work in arrays without any quotes - they're easy to spot though, as they're
usually in capitals (like DOCUMENT_ROOT).

> unexpected $end in c:\easyphp1-7\www\books.php on line 118
> the closing '?>' is line 117

You're probably missing a semicolon somewhere :-)

Cheers
Jon


____ � The WDVL Discussion List from WDVL.COM � ____
To Join wdvltalk, Send An Email To: mailto:[EMAIL PROTECTED] 
       Send Your Posts To: [EMAIL PROTECTED]
To set a personal password send an email to [EMAIL PROTECTED] with the words: "set 
WDVLTALK pw=yourpassword" in the body of the email.
To change subscription settings to the wdvltalk digest version:
    http://wdvl.internet.com/WDVL/Forum/#sub

________________  http://www.wdvl.com  _______________________

You are currently subscribed to wdvltalk as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

To unsubscribe via postal mail, please contact us at:
Jupitermedia Corp.
Attn: Discussion List Management
475 Park Avenue South
New York, NY 10016

Please include the email address which you have been contacted with.

Reply via email to