Jump to content
Larry Ullman's Book Forums

Recommended Posts

I have just completed reading PHP For the Web, and just started reading PHP and MYSQL for Dynamic Web Sites. Both are wonderful books. I have a few other PHP/MYSQL books. A few are ok, and a few are terrible. These books are great.

 

I am only on page 45 of the second book, but I noticed that in the first book, print is used where in the second book, echo is used. Also, in the first book, $_GET is used, where in the second, $_REQUEST is used.

 

Is there benefits to using echo and $_REQUEST? Please let me know. Thanks.

Link to comment
Share on other sites

Thanks for your interest in the books and for the nice words. It is appreciated. As for the differences that you point out, they really are minor. But I'll explain...

 

As for print vs. echo, both do the same thing. I use print in the beginner's guide because it's more obvious of a name than echo. In the QuickPro book I use echo, which I also use more in my own programming. The reason why is minor: there's a very, very, perhaps imperceptible performance difference between echo and print, with echo being ever so slightly better.

 

As for $_GET vs. $_REQUEST, those are actually two different things, and $_GET is better when you have to use $_GET. $_REQUEST includes both $_GET and $_POST and also $_COOKIE, so it's flexible but imprecise. So there are totally different reasons why I used those in the two books and would generally recommend you specifically use $_GET or $_POST accordingly. In rare situations, $_REQUEST makes sense, but it's less precise.

 

Hope that helps!

Link to comment
Share on other sites

 Share

×
×
  • Create New...