Re:Ask HN: What resources did you use to learn PHP?
by thwarted on Friday November 28, 2008 @04:23PM
(#379555)
The PHP website is one of the most complete and easily navigable and searchable language documentation websites I've ever used, and I directly blame it for my being so well versed in PHP that PHP has (grudgingly) been my tool of choice for years.
The quality of the documentation on php.net has actually gone down since they started wrapping everything in objects and using automatic documentation generators like doxygen. That's great for reference, but not so great when you're trying to learn it. The documentation for SPL (largely http://www.php.net/~helly/php/ext/spl/ ) is an example. The php.net website has traditionally been good for both reference and learning.
On the other hand, a lot of that "bad advice out there" is actually in the PHP documentation (like building query strings directly), which has caused it to pop up in other places. The comments on the documentation nodes are a great idea, but use anything in them with caution. If one comment says "Here's how I solved this problem..." there might already be function that did that and the poster didn't know about it.
As for pass by reference working with objects but not arrays... I think a lot of confusion over this comes from PHP4's crappy object model when objects were passed by value (which doesn't make any sense in an object model) and that people like to think of arrays like C arrays (which are just pointers). That arrays are not passed by reference by default seems to fit the immutability of other base types (however, I use the word "immutability" with caution there, since it's not strict immutability in PHP).
The quality of the documentation on php.net has actually gone down since they started wrapping everything in objects and using automatic documentation generators like doxygen. That's great for reference, but not so great when you're trying to learn it. The documentation for SPL (largely http://www.php.net/~helly/php/ext/spl/ ) is an example. The php.net website has traditionally been good for both reference and learning.
On the other hand, a lot of that "bad advice out there" is actually in the PHP documentation (like building query strings directly), which has caused it to pop up in other places. The comments on the documentation nodes are a great idea, but use anything in them with caution. If one comment says "Here's how I solved this problem..." there might already be function that did that and the poster didn't know about it.
As for pass by reference working with objects but not arrays... I think a lot of confusion over this comes from PHP4's crappy object model when objects were passed by value (which doesn't make any sense in an object model) and that people like to think of arrays like C arrays (which are just pointers). That arrays are not passed by reference by default seems to fit the immutability of other base types (however, I use the word "immutability" with caution there, since it's not strict immutability in PHP).