SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 38
  1. #1
    SitePoint Addict Divisive Cotton's Avatar
    Join Date
    Jun 2008
    Location
    Andy lives in London, UK
    Posts
    393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Memory aid tips for learning PHP

    Since I started learning PHP last September I've come on a long way but still keep stalling on stuff I should know off pat like "Does implode turn a string into an array or is that explode?" I then have to check php.net...

    I've got various function PHP cheatsheets that I've compiled as I've gone along - every time I use a new function I note it down on an Excel sheet. I get my girlfriend to test me on them - but there are thousands of inbuilt functions to know and be familiar with.

    Does anybody have any memory aid tips that has helped them learn PHP? Or is it a case of "if you use it enough eventually it will all be drummed into your head"?
    Let everyday be Christmas

  2. #2
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There's a really simple solution to this problem: use an IDE with calltips and code completion (I use Komodo for my PHP stuff).

  3. #3
    SitePoint Addict
    Join Date
    Nov 2005
    Location
    Germany
    Posts
    235
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Divisive Cotton View Post
    Since I started learning PHP last September I've come on a long way but still keep stalling on stuff I should know off pat like "Does implode turn a string into an array or is that explode?" I then have to check php.net...
    The PHP library is a mess. Don't even bother. Example:
    http://de3.php.net/manual/en/book.strings.php

    Quote Originally Posted by Divisive Cotton View Post
    I get my girlfriend to test me on them [...]
    This is really weird - I like that a lot!

    Quote Originally Posted by Divisive Cotton View Post
    Does anybody have any memory aid tips that has helped them learn PHP? Or is it a case of "if you use it enough eventually it will all be drummed into your head"?
    Even if you're using an editor without parameter hints and code completion there's always php.net as a reference. There's other problems when creating software than memorizing function signatures and they are far less trivial.

  4. #4
    @php.net Salathe's Avatar
    Join Date
    Dec 2004
    Location
    Edinburgh
    Posts
    1,397
    Mentioned
    64 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Divisive Cotton View Post
    Since I started learning PHP last September I've come on a long way but still keep stalling on stuff I should know off pat like "Does implode turn a string into an array or is that explode?" I then have to check php.net...
    Personally, I drilled it into my brain that explode-ing something breaks one thing up into many smaller things, and implode-ing is the opposite.

    Quote Originally Posted by Divisive Cotton View Post
    I've got various function PHP cheatsheets that I've compiled as I've gone along - every time I use a new function I note it down on an Excel sheet. I get my girlfriend to test me on them - but there are thousands of inbuilt functions to know and be familiar with.
    I really wouldn't worry about trying to learn all of the individual functions. Chances are there will be a core group of functions that you'll regularly use, then a haze of others that you'll need occasionally but are useful. Then there will be hundreds/thousands of others that you'll likely use only a few times if at all.

    Quote Originally Posted by Divisive Cotton View Post
    Does anybody have any memory aid tips that has helped them learn PHP? Or is it a case of "if you use it enough eventually it will all be drummed into your head"?
    Perhaps this might not be what you want to hear, but maybe some things will never just be drummed into your head regardless of how often they are used. I know that is certainly true for me. But on the hole, practice does make a huge difference with regards to becoming familiar with what is available.
    Salathe
    Software Developer and PHP Manual Author.

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't do a good job remembering function signatures(parameters, thier order, and return type). But I can usually remember the names(or something unique enough about the name to get me to it). I made a javascript bookmarklet a long time ago that searches php.net for me(it promps, or uses any selected text on the webpage), and I use it constantly.

    I don't really feel I'm slowed down much by having to look at the api real quick. It usually takes but a few seconds. But I've browsed php.net's function lists for many many hours so it's very often that my light bulb goes off and I think "oh I saw a function for this...". I'm quite happy with just being able to navigate the api quickly.

  6. #6
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2006
    Location
    Augusta, Georgia, United States
    Posts
    4,151
    Mentioned
    16 Post(s)
    Tagged
    3 Thread(s)
    Remembering how everything works on a generic level is by far more important then remembering specific signatures and what each function/method/class does. Normally, that can be taken care of in a matter of seconds by browsing the docs as long as you have a general idea of what you would like to accomplish. Learn the concepts and once you know those they can be applied throughout the entirety of the language and many ideas extend to other languages as well. Concepts are more important then specific signatures and what they do. No matter how much I use array_shift() and array_unshift() I still get confused between those two functions. However, it takes about ten seconds to resolve that issue.

  7. #7
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    I took the ZCE exam, and worked through the Exam preparation guide which is nothing but an explanation of really some basic principles that influence PHP but it importantly provides a really good checklist of things you need to go and read in the manual and practice up on.

    It really filled in lots of general gaps for me. Taking the structured Vulcan exams was very sobering, and I spent a lot of time with my head in the manual as a result.

    The exam has sadly turned out to be worthless, but the process was absolutely priceless.

    Have the manual .chm file open all the time, I have a virtual windowing system so the man is just a shift away (though I miss the user notes, grrrr) - have it on another screen, or even on another computer nearby.

    Search is crappy but the index works fast, find something close to what you want and the "similar functions" list at the bottom of the defn and examples nearly always leads to a solution, for me.

    As I have no CS background and am by nature a very lazy person, and it was only by setting myself a date (and paying) for the exam that I was motivated enough to take the necessary time out - about 3-4 hrs a day for about 6 weeks to follow a structured learning process. Best thing I did.

  8. #8
    Grumpy Minimalist
    Join Date
    Jul 2006
    Location
    Ontario, Canada
    Posts
    424
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In addition to calltips and code completion, Komodo allows you to click within any function name and press shift+F1, which takes you directly to the PHP docs for that page (complete with user notes! )

    Unfortunately that feature was broken in the latest build, but a patch is already committed.

    There's also a free version which includes these three features.

    Because of these features I rarely have to go to the manual; when I do it's for looking at the exact return values of a function. For example, I often got confused between array_shift and array_unshift, but calltips solve that problem. I also once mixed up parameter orders with a lot of array searching functions (is it needle or haystack first?), which calltips also solve. And, if I can't remember the name of a function (what's the function that does a case insensitive comparison of strings in natural order?) but remember the class of functions to which it belongs, code completion can help remind me. And, if in doubt, the manual is just a shift+F1 away. Oh and, these features also work for functions/classes you define as well!

  9. #9
    SitePoint Addict wibble wobble's Avatar
    Join Date
    Dec 2008
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I absolutely recommend you use an IDE. Code completion is one of the most helpful and time-saving things a programmer can have (probably 2nd after code generation). Check out NetBeans -- it is free and is simply the best IMO.
    Find freelance jobs from all the major sites in one place:
    on twitter / on the web / twitter rss feed

  10. #10
    SitePoint Wizard rguy84's Avatar
    Join Date
    Sep 2005
    Location
    Durham, NC
    Posts
    1,659
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wibble wobble View Post
    I absolutely recommend you use an IDE. Code completion is one of the most helpful and time-saving things a programmer can have (probably 2nd after code generation). Check out NetBeans -- it is free and is simply the best IMO.
    I like NetBeans also. The only thing I don't like about NetBeans is that you cannot just start coding. You need a project.
    Ryan B | My Blog | Twitter

  11. #11
    SitePoint Member Five 25 Media's Avatar
    Join Date
    May 2009
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I refrence PHP net about 30 times a day, not to mention I use DreamWeaver CS 4 and it's code completion is very good.

  12. #12
    SitePoint Addict wibble wobble's Avatar
    Join Date
    Dec 2008
    Posts
    242
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by rguy84 View Post
    I like NetBeans also. The only thing I don't like about NetBeans is that you cannot just start coding. You need a project.
    A good way to get around that is to have a "scribbles" project. That can be used for testing stuff and tiny little things. Everything else really should be in a project -- then you get code completion for classes in other files.

    Quote Originally Posted by Five 25 Media View Post
    I use DreamWeaver CS 4 and it's code completion is very good.
    Oh please...
    Find freelance jobs from all the major sites in one place:
    on twitter / on the web / twitter rss feed

  13. #13
    SitePoint Evangelist ldivinag's Avatar
    Join Date
    Jan 2005
    Location
    N37 33* W122 3*
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    or have a second monitor to have php and mysql's doc pages up on them...
    leo d.

  14. #14
    SitePoint Guru glenngould's Avatar
    Join Date
    Nov 2005
    Posts
    661
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I sometimes have a similar problem while coding in different languages. I use php, javascript and actionscipt most of the time, all having slightly different syntax and different signatures for various tasks.
    For instance, I forgot which function to use for a certain string manipulation or pick the wrong one that does not exist in that particular language.
    Tweep List adds an avatar menu to Twitter (open source)
    Word Stats shows your most used words on Twitter

  15. #15
    SitePoint Enthusiast
    Join Date
    Apr 2001
    Location
    London, UK
    Posts
    59
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    at the end of the day, practice makes perfect... the longer you code in PHP, the more you memorize stuff, and the less you will need to check references. It's not shameful to check reference docs, it's natural.

    Once you start learning other languages, you discard the concept of 'memorize everything', because its simply not possible to memorize all libraries for multiple languages.

    Like others have said, the best thing you can do is get an IDE with good code completion and easily accessible documentation. My IDE recommendation would be Eclipse PDT.

  16. #16
    SitePoint Member Five 25 Media's Avatar
    Join Date
    May 2009
    Posts
    9
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wibble wobble View Post
    Oh please...
    Oh please what? Let me guess, you're one of those people who tried DW back in version 1 or 2, and think it's complete crap now on version what, 12? Stop being such a ignorant person.

  17. #17
    Non-Member
    Join Date
    Jan 2004
    Location
    Seattle
    Posts
    4,328
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, this is turning into another "What's the best text editor?" thread. I was inspired to check out Komodo and was blown away. No wonder you guys know more than I do.

    As a bonus, I noticed Komodo is designed to work with Firefox.

  18. #18
    SitePoint Wizard silver trophybronze trophy Cups's Avatar
    Join Date
    Oct 2006
    Location
    France, deep rural.
    Posts
    6,869
    Mentioned
    17 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by wibble wobble View Post
    A good way to get around that is to have a "scribbles" project. That can be used for testing stuff and tiny little things. Everything else really should be in a project -- then you get code completion for classes in other files.
    I use PHP Interactive shell, really handy little scratch-pad.

  19. #19
    SitePoint Wizard
    Join Date
    Dec 2003
    Location
    USA
    Posts
    2,582
    Mentioned
    29 Post(s)
    Tagged
    0 Thread(s)
    I don't think you should worry about trying to memorize every little function. Usually, when you are working on a certain project, there is a subset of functions that you'll use a bunch for that project. Just look them up as needed and eventually you won't need to look them up for that project anymore.

    Also, if you try to memorize it too specifically for one language, you'll get them mixed up in other languages. PHP and Javascript was already mentioned as one that is easy to get confused on.

    I've always been a proponent of memorizing what types of functions languages should have, and looking up their exact syntax, instead of memorizing exact languages for exact functions... because you can't keep them straight. I've been using about eight different languages on a weekly basis, and trying to keep exact syntax for each language straight is nearly impossible.

    Now, if you're going to take an exam on a language, that's a different story, but even still, once you finish the exam it shouldn't be much of a concern to keep it straight as it is just knowing what a language should provide.

    For example, just about any language will provide functions like substring, indexof, etc. Whether the exact function is substr(), substring(), sub(), etc., is of much lesser importance to remember, since you can always look at some reference in about 3 seconds.

  20. #20
    SitePoint Addict elemental70's Avatar
    Join Date
    Mar 2002
    Location
    Canada
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    For an IDE I recommend Aptana. Free, multiple languages, continually updated and has call outs auto complete, etc. Amazing tool. Also has the most current Ajax libraries.

  21. #21
    Guru in training bronze trophy SoulScratch's Avatar
    Join Date
    Apr 2006
    Location
    Maryland
    Posts
    1,838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't, because there is absolutely no consistency in that whole language regarding naming conventions or argument order. Just look it up when you need to, or as others have stated get a decent IDE.
    Cross browser css bugs

    Dan Schulz you will be missed

  22. #22
    Non-Member DelvarWorld's Avatar
    Join Date
    Jul 2004
    Location
    Baloney
    Posts
    341
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP has no function naming standards. Trying to memorize functions is like trying to nail jello to a tree.

    edit: beaten by soulscratch but my post is still better

  23. #23
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ldivinag View Post
    or have a second monitor to have php and mysql's doc pages up on them...
    Just two? I have four at work. Three at home. Multi-monitor makes a hoooge difference.

    Also, I haven't seen it mentioned, but for speed lookups on php.net, take advatange of their rewrite rules. Just go to php.net/ and put the name of the function you want at the end.

    For example, php.net/strpos

    PHP's parameter order seems to be mostly random, especially for string functions, so unless I use them all the time I look them up.

  24. #24
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by UFTimmy View Post
    Just two? I have four at work. Three at home. Multi-monitor makes a hoooge difference.

    Also, I haven't seen it mentioned, but for speed lookups on php.net, take advatange of their rewrite rules. Just go to php.net/ and put the name of the function you want at the end.

    For example, php.net/strpos

    PHP's parameter order seems to be mostly random, especially for string functions, so unless I use them all the time I look them up.
    You can set up a firefox keyword search as well... i type 'php <functionname>' into the address bar and it brings up the documentation for that function. Great timesaver!

  25. #25
    SitePoint Member gavin.williams's Avatar
    Join Date
    May 2009
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Rightly so. I love the solution. It really works


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •