JaneDean Posted January 28, 2007 Share Posted January 28, 2007 Hi,I am very new to PHP (and probably at a disadvantage to many other PHP coders, because it's the first coding/programming language I've learnt), and I'm having some trouble with when to use quotes in PHP. I am learning from a book, and sometimes I am told to call variables using single quotes, eg. $_POST['name'], and sometimes using none at all, eg. $_POST[name]. I have found that whether or not I use quotes actually does make a difference, and using them unnecessarily can break the script, as well as vice versa. I was wondering if anyone could explain this to me?Sorry if this is a stupid question. I've been wondering since I started the book, and I still haven't worked it out.Thanks in advance,JaneDean Link to comment https://forums.phpfreaks.com/topic/36039-solved-to-quote-or-not-to-quote/ Share on other sites More sharing options...
Jessica Posted January 28, 2007 Share Posted January 28, 2007 The manual explains this:http://us2.php.net/manual/en/language.types.array.phpScroll down to:"Array do's and don'tsWhy is $foo[bar] wrong?"It seems you're using an old book. Link to comment https://forums.phpfreaks.com/topic/36039-solved-to-quote-or-not-to-quote/#findComment-171024 Share on other sites More sharing options...
JaneDean Posted January 28, 2007 Author Share Posted January 28, 2007 Aah, thanks for your help. I think I am using an old book; I've had a few problems like this with it. But I am genetically required to use anything I have paid good money for ;).Also, thanks for the link to the manual. It looks like a much faster way to clean up any problems with the book. Link to comment https://forums.phpfreaks.com/topic/36039-solved-to-quote-or-not-to-quote/#findComment-171031 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.