Jump to content

Does anyone else forget their PHP conditions etc easily?


zaniac

Recommended Posts

I've just started learning PHP, but find it easy to forget the things that I have learnt. I've not really had this issue with CSS and XHTML in the past. I use this site and a PHP book to learn from and I have not had a problem yet in understanding the meaning of the different conditions, operators etc in which I've currently read about.Just wondering, do any of you people find you are often refering back to books etc to find the correct conditions etc in PHP?Any input or learning advice, is greatly appreciated :)

Link to comment
Share on other sites

Sometimes... especially when I don't have a good editor like Dreamwaver to back me up. With it I can see if I've spelled a function name correctly and see the arguments it expects. That is very important as I can't remember every function's prototype.As for language constructs (conditions, loops, etc.).... only with the "for" loop really (which btw could be the only loop you need as it can do everything other loops can). I've gotten used to the conditionals and the operators I use frequently ("==", "!(condition)", etc.) so I don't really refer to anything for them now. I used to though.You simply need to place yourself a goal to achieve. And it should be a reasonably easy one, but still something out of your league. For example, enter and fetch a data from a database. No meaning, no real life use, but if you're still learning, it could be pain in the neck. For me, the simple scenario was running an XSLT transformation, which considering XSLT's power did more work then you might think. Once simple scenarios like that are done, progress forward, building them up (in my case, that was passing a parameter to the XSLT processor that came from GET parameters and was validated before that) and then you'll probably get accustomed to whatever you learned making simple stuff like that. Once that is done, you'll probably be ready for a real world application and won't refer to anything other then function prototypes and more complex syntax constructs (which you never used in the simple apps).

Link to comment
Share on other sites

For loops are my enemy, in any language. :) I just can't remember the correct syntax.Most of the functions are basically useless in most cases, so it's not like you need to know every single one. I have a PHP Phrasebook that I look in when I want to find a function, but I don't remember most of them.Doctypes are impossible for me too. I just have XHTML, XHTML strict, XML etc. .txt files saved on my computer, and I open them when I need the doctype, and then save it with a different name.Once you use a function more often (like mysql_real_escape_string() ) you should get more used to it, and remember it better.

Link to comment
Share on other sites

Hi guys thanks for all your replies, you've given me reassurance in times of doubt hehe. I'm on what I think is very basic PHP, I've just learnt the 'if', 'else' and 'elseif' conditions, which seems pretty easy so far. I'm sure harder times will follow soon. :)

Link to comment
Share on other sites

I always use a reference like php.net when I program. I've done enough programming so that by now I know how to use control structures and operators, but I always look up function syntax, there's no reason to try and memorize all of that.

Link to comment
Share on other sites

Hi guys thanks for your ideas. When I last looked at the PHP manual online, I'm sure I got lost inside it, just after reading a few pages. Every page of the manual I looked contained links which also contained more and more links etc etc. It kind of put me off looking, but if others are finding it easy to refer to, then it's probably best if I go into the online manual again and use for brief references only. Thanks all again :)

Link to comment
Share on other sites

im learning PHP at the moment too. ive known the basics for years but im trying to learn it properly. its certainly harder to learn than xhtml/css

Just wondering, do any of you people find you are often refering back to books etc to find the correct conditions etc in PHP?
yes constantly using the web
Link to comment
Share on other sites

Hi guys thanks for your ideas. When I last looked at the PHP manual online, I'm sure I got lost inside it, just after reading a few pages. Every page of the manual I looked contained links which also contained more and more links etc etc. It kind of put me off looking, but if others are finding it easy to refer to, then it's probably best if I go into the online manual again and use for brief references only. Thanks all again :)
The manual isn't all that hard to use, you just have to know what you're looking for. I've never just read through it though, I only use it for reference. The TOC is here:http://www.php.net/manual/en/For reference, you can avoid chapters 1 and 2, those are the tutorial and installation chapters. I don't use much of chapter 4 either, but it never hurts to read through that. Chapter 3 in the manual, Language Reference, is everything about PHP that doesn't have to do with the function libraries. I use the Variables section of the Language Reference to look up info on things like $_GET and $_SERVER in the Predefined Variables section. The section about Constants I don't use much, there's not a lot to learn about constants. The section on Expressions is just a general overview of the concept of expressions which I already learned in school, others might find that useful. You'll probably want to look through the section on Operators, but that's another example of a section that I wouldn't read, only refer back to. I might read the initial page on Operators, but I would only go to the specific pages e.g. Comparison Operators if I had a question about a specific operator. The Control Structures section is where you learn about if, switch, for, while, etc, all of the program control structures. The Functions section of the Language Reference is about the syntax and semantics for using and creating functions. There are 2 object-orientation sections covering how objects and classes work in PHP 4 and PHP 5, and then you would only use the sections on Exceptions and References if you know what those are and need to use them.The chapter on Features covers concepts like uploading files, using cookies etc. The other chapter in the manual that I use is the Function Reference, which has information on all of the built-in functions in the various PHP libraries. It can be a little confusing to try and find a function you don't know the name for, but the search engine on the site is pretty good.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...