Core PHP Programming 223
Core PHP Programming (3rd Edition) | |
author | Leon Atkinson with Zeev Juraski |
pages | 1041 |
publisher | Prentice Hall PTR |
rating | 9 |
reviewer | Tony Williams |
ISBN | 0130463469 |
summary | Good comprehensive guide for beginner to expert |
The authors of Core PHP Programming have found a marvelous middle ground. Toward the beginning of the book they have a great deal of light, explanatory material as they cover the basics of PHP. As they move towards more advanced topics there is less explanation and a tighter packing of information. At the same time the book has a large number of small code examples throughout, making sure that you know how to use the functions under discussion.
This is the third edition and I must admit that I had not come across it in either the first or second editions, so I have no great way of comparing them in this review. It has certainly been revised to take into account the changes for PHP 5 and examining the table of contents for the second edition on Safari I can see the that the basic structure has remained the same while the book has grown about 300 pages. The addition of Zeev Suraski as co-author can only be to the benefit of the quality of the information, particularly regarding PHP 5.
The book starts with the absolute rock bottom of PHP, the basic data types and operators through to efficiency, debugging and design patterns. Along the way it covers almost all aspects of PHP 5 with a readable reference style. The 'Core' in the title of this book is a key to understanding it. If you're looking for a book with all the code required to handle session management, or user logins and security (to mention two possibilities) then this isn't the book for you. If, however, you are after a book that more than adequately explains the power and nuances of PHP and programming in the language then this is a marvelous volume.
It's broken up into 5 sections: "Programming PHP," which covers the basics of data, control flow and I/O; "Functional Reference," which is 600 odd pages broken up into 12 chapters that seems to cover every PHP function (a check of three sub chapters showed every function mentioned on the topic at PHP.net was also in the book) and does it well with good explanation and code examples; "Algorithms," which details a number of methods of performing routine tasks such as sorting, parsing and generating graphics; and "Software Engineering," devoted to design, efficiency and design patterns; and finally, there are a seven excellent appendices.
Taken as a whole it does a good job of covering the whole language and the ways of using it.
I can imagine it would make a good companion volume to my other favourite PHP volume, PHP and MySQL Web Development, which tends more towards recipes and leaves out the encyclopedic coverage of this book.
Leon Atkinson has a good page for the book that includes a link to download all the code and examples, a link to the Prentice Hall page for those wanting an example chapter or a look at the Table of Contents and some other reviews. His site also has a page for the inevitable errata, currently blank. While I did find only one typo (not in example code) I can't claim to have read every page or run all the code examples.
I'd recommend this volume to anyone who wanted a comprehensive guide to PHP 5. It is probably useful at almost all levels.
You can purchase Core PHP Programming, 3rd Ed. from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
Needed? (Score:2, Insightful)
Re:Needed? (Score:5, Funny)
Online REFERENCE (Score:3, Insightful)
There are also, like any real world programming language, many ways to approach the same problem.
Sometimes there are BAD ways (a function might exist to do something simple and quickly and shouldn't be used as part of a more complex solution)
The online docs don't answer the questions like:
What's the best way to read in an apps config file and perhaps even write it back out?
How
Re:Needed? (Score:1, Insightful)
Re:Needed? (Obligatory reply) (Score:5, Insightful)
I always print out the manuals, faqs and howtos I read frequently. I also print out important e-mails.
Re:Needed? (Obligatory reply) (Score:5, Insightful)
yes, but....
Re:Needed? (Obligatory reply) (Score:3, Insightful)
Re:Needed? (Obligatory reply) (Score:2)
The documentation on php.net is leaps and bounds better than the documentation on any other website I've found. The user comments are very helpful - quite often, my question is answered by one or more of the comments.
I also print out important e-mails.
You must work at my company, printing email seems to be popular here. Print it out, file it in a drawer. I just don't get it.
Re:Needed? (Obligatory reply) (Score:2)
Re:Needed? (Obligatory reply) (Score:2)
Re:Needed? (Obligatory reply) (Score:2)
You can't earmark pages to find the important stuff. You find the important stuff, then earmark the pages.
I'm not particularly fond of handling something concrete if it's going to make it a bunch more inconvenient to find things. I can find an arbitrary PHP function on the PHP site just by putting its name after php.net in the URL. With a printout, no such luck. With a book, you have to find the index, then find the function, then find the page.
Honestly for a bunch of programmers you think efficienc
The online PHP documentation could be improved (Score:1, Informative)
Re:The online PHP documentation could be improved (Score:4, Informative)
http://php.net/quickref.php
Re:The online PHP documentation could be improved (Score:1, Insightful)
Re:The online PHP documentation could be improved (Score:4, Informative)
http://www.php.net/mirroring.php [php.net]
I've set up a mirror for internal use at work. Just run rsync in a cron job every week or month or whatever to keep things up to date.
J
Re:The online PHP documentation could be improved (Score:4, Informative)
Also, when you want the lowdown on a function, it's super easy to just enter
www.php.net/functionname
into your browser, and you're forwarded straight to the functions documentation, and usually also the local mirror. Sweet stuff.
Re:Needed? (Score:5, Interesting)
I will admit I've got 2 O'Reilly books on PHP (Programming and the Cookbook) but more often than not its easier to just hop on their site and search there. The books are there to look cool with the rest of my O'Reilly collection.
Personally I like the user comments in the online docs the best. Half the time someone's already written some small function that I'm looking for, or quite adequately explained all the various cases of some esoteric function return.
Re:Needed? (Score:2, Informative)
Re:Needed? (Score:3, Insightful)
Your comment is rather disjointed, were you trying to link between online docs being unreadable and php5 docs not being online, while claiming the book is exactly opposite, with easy to read PHP5 documentation? Or do you just suck at typing?
Re:Needed? (Score:5, Insightful)
The online docs do not say HOW to program in PHP.
Yes, they are a great reference, and actually are the best online docs I have seen (mostly due to the comments), but you still need to know how to program to use them.
OTOH, a good programming book will step you through on HOW to use the various functions, not just what the functions do. Things like layering, magic number constants, security etc.
Re:Needed? (Score:2)
The first five sections (especially the first to) are more than adequate in teaching how to program in PHP.
teach you how to program? (Score:2)
Re:Needed? (Score:2)
I have an earlier edition of this book, and I was massively underwhelmed. It was as if somebody printed out the online manual and prefixed it with a few average tutorial chapters. The actual useful content of the book to a beginner was approximately a quarter of the overall page count.
I can't say whether or not this edition has improved the situation, but if the publisher was willing to churn out such a low-quality book before, I don't have high hopes for this new edition, especially as it seems to be
Re:Needed? (Score:2)
*troll* Of course since PHP breaks many commonly accepted practices of good programming by default, HOW to program might be appropriate for it.
Re: (Score:2)
Re:Needed? (Score:3, Insightful)
So basically you fill the first half of the book with a bloated version of the instructions that are already on the web site. Then you fill the second half with a printout of the function library off the web site. Then you just need to put a bit of padding around it all describing a language which isn't even complete yet.
This sounds worse than the typical Java book scenario, where they fill half the book with dry and obvious instruction, and the second half of the book with the Javadoc printouts. In de
Re:Needed? (Score:3, Interesting)
$39.95? (Score:2)
Re:Needed? (Score:1)
Re:Needed? (Score:2, Interesting)
I pointed out that a pen and paper have a very high resolution indeed compared to a monitor and the gui is very flexible and quick.
Similarly, a book is easier on the eyes, very portable, well-indexed, has a consistent format and quality and probably has been better-edited.
Re:Needed? (Score:2)
What? (Score:1, Funny)
Re:What? (Score:2, Funny)
{
printf("Jorkapp is a programmer");
main();
}
Jorkapp is a programmer who does not know that this will eventually core dump because it will fill the stack.
Is this really the right thing? (Score:2)
Hmm.. shouldn't that be the other way 'round? I mean, I prefer to have the easy (self-speaking) topics with a tighter packing of information and less explanation than the hard topics, where I could use all help.
I gotta go with PHP CookBook (Score:3, Informative)
If you know PHP to a certain degree, this book is very useful, and presents real world examples. It is very up to date, and even covers things like PHP OOP and PEAR.
Core PHP Programming (Score:1)
When PHP looks like an appealing language... (Score:1, Funny)
God, I feel like this code was carved into stone tablets.
Incomplete PHP5 (Score:4, Insightful)
PHP in 24 hours 3rd edition does. (Score:3, Interesting)
on amazon. [amazon.com]
PHP books *are* needed, just not all of them (Score:5, Insightful)
*Some* books are good (although I think there are too many which repeat the same information, not enough focus on particular topics in the PHP world) and necessary because they can go into greater detail than you get from the online docs.
"What about online tutorials?" Some are good, but having it all in one book, written by only one or two authors (as opposed to wrox-style 15 authors) can help keep a consistent presentation of concepts from beginning to end.
I'm not saying online sucks and all books are great - many PHP books aren't all much more useful than the online docs really. But for those that try to actually teach, rather than reprocess, I think they can be more valuable over time than *just* the online docs.
Personally, I think this 3rd edition is good, although there is, imo, too much reprocessing of the manual. You could cut 200-300 pages out of this book and not miss much of anything. What would be left is worthwhile, though. What's missing in all the reference material is details on what, if any, differences there are between PHP4 and PHP5. If it's there it's in text form, not a standard icon set to alert you of potential differences.
BTW, I have roughly the same arguments for PHP training courses, which we teach (subtle plug). "It's all online!" isn't the best answer for everyone. Many people struggle for hours or days with some concepts with only tutorials and reference pages. Put them in a classroom where they can get immediate feedback on new concepts, and they get it much quicker. Each person learns and adapts to new information in different ways, and classroom training is appropriate for some people, whether it's "only" PHP or something else.
Re:PHP books *are* needed, just not all of them (Score:1)
Re:PHP books *are* needed, just not all of them (Score:5, Informative)
There's an older NewRiders book by, argh, lost the name - blue/purplish spine, something like "Web Application Development with PHP". One of the first books I saw on PHP where they went into advanced concepts, and didn't treat the reader as if they knew no programming. You were walked through various business problems and shown how they were addressed, and IIRC chapters built on earlier chapters for continuity.
Some WROX are OK, but it's hit and miss.
Haven't read the new Schlossnagle book yet, but it looks good too (likely more internal, gutsy type stuff not just 'here's a variable' kind of thing).
HTH
Re:PHP books *are* needed, just not all of them (Score:2)
Remember that Wrox is out of business. They sold off their titles to a number of different publishers who have since repackaged them under new imprints. Same thing with Coriolis.
Re:PHP books *are* needed, just not all of them (Score:2)
If you're just 'learning PHP' (ie from another language before) then the online manual is plenty.
Having been a fulltime developer using PHP for a while I'd say that the one major thing with PHP, the main reason why the PHP online manual should be used over books, that doesn't apply so much to perl/java/tcl etc. PHP breaks major functions in minor version increments, you may think I'm trolling but its the truth. One good ex
Re:PHP books *are* needed, just not all of them (Score:3, Interesting)
Re:PHP books *are* needed, just not all of them (Score:2)
It seems to me that these issues seem to crop up less and less as time goes on, hopefully thats all part of PHP maturing and we won't see that kinda problem again..... *crosses fingers*
Namespaces (Score:3, Informative)
Hate it when that happens (Score:2)
Studies have shown that IDP occurs in only two dimensions, and is reliably influenced by other periodicals within a distance approaching three meters.
Researchers where able, as an example, to block the IDP of a Sears Craftsman Tool Catalog with the July 1999 issue of Playboy Magazine.
In turn, an unabridged copy of War/Peace required two copies of Lady Chatterley's Lover before the IDP succumbed.
I have a soft spot for PHP... (Score:2, Insightful)
Personally I feel that J2EE and JSP is a more 'enterprise' technology for this kind of development with large transactional systems but the nature of PHP tends to lend itself more to the lightweight, free web development and is supported by a growing number of hosting companies (even free hosting companies).
I do question the need for yet
Re:I have a soft spot for PHP... (Score:2)
Re:I have a soft spot for PHP... (Score:2)
Get a session to migrate across a cluster in PHP, without roundtripping to a DBMS like mysql. Non-trivial problem, even J2EE containers often don't get it right (far as I know ASP.NET doesn't even try, but that's another story).
Got an app that causes a fatal li
Re:I have a soft spot for PHP... (Score:2)
This is a design issue, not a PHP issue. With a proper controller system (not part of PHP, but can be designed in PHP with things like LogiCreate [logicreate.com]) this is simply not true. Use a user-defined function to do the includes and have it trap the error, or dig deeper into error-handling in PHP.
This is the result of lazy or unclued-in thinking on the
Re:I have a soft spot for PHP... (Score:2)
Firstly it is purely a web-development language, analogous to the JSP aspect of the J2EE, of the ASP.net aspect of
J2EE (and to a lesser extend
Real programmers only write in... (Score:4, Insightful)
Re:Sorry, but this is fucking stupid. (Score:2)
Re:Sorry, but this is fucking stupid. (Score:4, Insightful)
it's hard, very hard to break the bad habits instilled in "new" programmers. get em while they're young. that's why i like the fact that python *forces* good form and whitespace. just the notion that it won't work if it's not properly formatted will carry over to other languages when someone moves on to another language, and good style will as well.
understanding the difference between tabs and spaces isn't something too hard for anyone attempting to learn a programming language to tackle.
the parent is gonna get un-modded for this, but i just had to say something...
Re:Sorry, but this is fucking stupid. (Score:2)
I guess the moral of the story is that no matter how well you design a programming language, it won't help any if the programmer is sufficiently stupid/lazy.
Re:Sorry, but this is fucking stupid. (Score:2, Interesting)
That's probably why PHP has a bad name. That and magic quotes.
Re:Sorry, but this is fucking stupid. (Score:2)
PHP Cookbook from O'Reilly (Score:5, Interesting)
I've recently gotten back into using PHP for medium-size sites, after a brief period of hating it. I hated the security problems, the "fake" OO, the arbitrary stuff like magic quotes, the procedural functions. However, I've changed my opinion a bit: in security, you can have the PHP engine OFF and very tight in the
PEAR (object-oriented extension library) is pretty cool. If you've never used it, try it out: "wget -O- http://go-pear.org/ | php -q".
And PHP5 looks great, I love the fact that it has exceptions, interfaces, and type hints, that will pretty much kill Java on the medium/small end of the scale. So I decided to start using PHP again.
Anyway, the only good book I've seen is the O'Reilly Cookbook. They totally missed the PHP bandwagon but they redeem themselves with this one. It's clearly written, very thorough, and includes recipes of all levels. I learned a lot about PHP just by reading through the recipes. They usually present one clear way to do everything, plus make some useful discussion on performance and security when appropriate. The authors cleary understand PHP deeply.
And the book is pragmatic, unpretentious, and clearly designed to help you get your work done, rather than present a list of "my language is cooler than yours" tricks. Unlike certain others *cough* Python cookbook *cough*. (Granted, that's also a property of PHP itself).
So if you've got the basics of PHP (which you can glean from the PHP web site or from studying other people's code), try the O'Reilly book. It's probably the only one you'll need until PHP5 comes out.
books great for preparation... (Score:1)
When on the train going to and from work, it served as great reading material.
When on vacation, it was great reading material.
What does all that accomplish? Well it prepared me to better understand the online documentation when I needed to use it. Now, I easily go to php.net in order to remember what arguments or how many a function takes, etc...
In my opinion, this is the best
Re:books great for preparation... (Score:3, Interesting)
Might as well start learning PHP (Score:2)
It appears that this book is a good place to start, but anyone have any good intro to PHP book ideas for someone coming fresh out of the MS Camp? Also starting PHP tips and similar experiences appreciated
Don't Dread It (Score:2)
--Richard
Re:Might as well start learning PHP (Score:2)
Of course, if you want to learn this way, you have to have a project that you want to do. That'
Start Under IIS (Score:2)
Great for Beginners and Pros (Score:2, Interesting)
Wore my book out...
Technical Writing (Score:5, Insightful)
You've just described some of the basics of good technical writing. The basic theory of writing good technical documentation is identifying your audience and writing so not only does the document answer the audience's questions and provide usefully comprehensible information, but also refers the more literate and technical readers to more detailed sources.
Anyone aspiring to be a writer - either professional or just notating code - should take a few technical writing classes. There's an industry that's refined the process of technical writing and there's no sense to reinvent the printing press - so to speak.
With PHP5, why not use Perl? (Score:4, Interesting)
But every version has added on more features. Now instead of a smooth and light templating language, people are now writing templating languages to be parsed by PHP. Gahh! The proper response to all the trolls that insult PHP by saying that it isn't a real language is not "Wait until version 5! It supports class introspection!" Instead, the PHP community should have said that PHP wasn't meant to be a "real" language.
Now that PHP requires a 1000-page book, why should it exist? Why not use Perl, or Python, or C?
I will say that the PHP community is a very friendly and helpful group of people. Perhaps that is because so many PHP developers were previously graphic designers, and so they still remember how daunting programming can be to learn.
Re:With PHP5, why not use Perl? (Score:5, Insightful)
Perl is a great tool. But it is more of tool to use on files then a tool to create webpages. Using perl to generate html or rather bits of html is like using a fully loaded factory workshop to hammer in a nail. Overkill.
Python. No idea.
C? You gotta be kidding. Compiling each time you make a change to page? C would be like using nanotech to create a new material from wich you can cast a hammer to insert a thumbtack. Overkill doesn't even begin to describe it.
PHP may have gotten big but at its heart it still does the same what it did originally. Make dynamic websites. Sure you can mess with OO a bit and a lot more in 5 but if you don't want you never need to touch it. You don't need to access any database. You don't need to use shared memory to store variables. But you can if you want to.
Perl is often used but approaches it from the other side. Great toolset with web added on. PHP is web with a great toolset added on.
Of course real web developers know both.
Re:With PHP5, why not use Perl? (Score:3, Insightful)
Eh? With Perl you use what you need. Nothing beats CPAN. PEAR? not even close. And when you need something non-standard in PHP (graphics libraries?) You have to compile the whole thing again.
Then there's all kinds of other things that you just can't do in PHP without rolling your own or t
Re:With PHP5, why not use Perl? (Score:2)
The reason PHP has caught on is because it does what a lot of people need, and it's easy enough to learn. Of course, a good argument can be made that many people are writing "applications" in PHP that have no business doing so, and unchecked input has caused many posts on BUGTRAQ. But this seems to be just as much of a problem for other lang
Re:With PHP5, why not use Perl? (Score:2)
Re:With PHP5, why not use Perl? (Score:2)
I have no problem with ISP's installing PHP for users, its great for them and it can be made relatively safe. I'm a sysadmin and I have it installed for my users, but when I'm doing a serious project I much prefer Perl if I have a choice.
And many ISPs and other sysadmins I'm familiar with run PHPs as CGI rather than as a part
Re:With PHP5, why not use Perl? (Score:2)
For serious projects, I agree that Perl is a much more powerful langauge for getting stuff done in.. In the past, I've done hybrid Perl/PHP sites, with Perl doing the dirty parsing work and stuffing results into a database, and a pretty, low-cpu-using PHP front-end for the users.
This was back in the register_globals days mind you, and the reason
Perl can embed in HTML too. (Score:2)
Re:Perl can embed in HTML too. (Score:2)
Its also the reason I've never used Mason, I disagree with that practice.
Re:Perl can embed in HTML too. (Score:2)
Re:Perl can embed in HTML too. (Score:2)
Re:With PHP5, why not use Perl? (Score:2)
Actually, C or C++ is not completely wrong for generating web content. But your point defines exactly where to draw the line. If you are writing an engine that parses some special purpose templating language of your own, C/C++ may be the right way to go. Frankly, I'd lean toward J
using Perl or C/C++ to generate HTML (Score:2)
Re:With PHP5, why not use Perl? (Score:4, Insightful)
PHP has always looked too much like shell scripting or C to be friendly to non-programmers. I love PHP precisely because it is extremely easy for a *programmer* to pick up, but has a lot of functionality with which you can improve your naive first implementation.
My first PHP programs involved lots of calls to external apps, particularly grep and find. That ability allowed me, as a unix-tool-using programmer, to quickly hack together PHP that I could later improve. But I can't imagine picking up PHP as a non-programmer and having the first clue how to use it.
Re:With PHP5, why not use Perl? (Score:3, Insightful)
1) A lot of people like to have code tags embedded in their HTML. You can do this in Perl with Mason, or EmbedPerl, or what have you, but good luck getting cheap hosting where you have that set up.
2) Perl running through CGI has a lot of limitations, it is somewhat slow, you are limited in where you put scripts, etc. These are overcome by moving to mod_perl, but if you have a big server that is serving up a lot
Re:With PHP5, why not use Perl? (Score:3, Insightful)
Sounds familiar (Score:2)
Well I didn't read the article. But seriously though, what kind of review can you expect from a reviewer who can't be bothered to read the whole book?
While I'm all for learning.... (Score:2)
"the book covers PHP5, but since PHP5 is still changing the book leaves a lot to be desired. There is no information at all on SimpleXML, which will probably be the prefered XML handler once PHP5 is released. When I bought the book I was expecting it to be one of those books that gets worn out from use. Personally I would wait to buy books on PHP5 until PHP5 is out.
CB
Good book but... (Score:4, Interesting)
1) I loved the objected oriented aspects, but was disheartened to learn most of that code only applies to the latest PHP, which isn't deployed in most ISPs.
2) The index is terrible. Thank God the online docs are good. I've rarely been able to use the book as a reference.
3) I'm probably being dense, but I had trouble finding the sample code online. I expected it on Prentice Hall's website or at least an obvious link. (It's on the author's site)
I'm whining, but I really did like this book and would still recommend it.
2nd edition is nice, too (Score:2)
PHP Compiling (Score:2)
Re:PHP Compiling (Score:2)
This book is actually terrible. My PHP-Mag review (Score:2, Interesting)
It's supposed to be published in one of the next few issues.
This book is terrible -- If I were to give it a slashdot review rating -- it would be *3* and that is being generous.
Below is the hyperlink to my review:
http://www.wizardtechnologies.net/reviews/phpmag-c pp.html [wizardtechnologies.net]
Re:1041 pages of PHP? (Score:2)
A corporate web designer's job SHOULD be to make the web site look nice and make it easily navigable. Code is not the first priority. Why pay for a code monkey AND a web monkey if you only need very basic code with a nice layout?
Re:1041 pages of PHP? (Score:2)
Because they're two different jobs? One person makes the art and the static HTML, the other programs the dynamic sections which are almost always the parts of a website that get exploited.
By your logic the technical writers should code as well since they're dealing with the application too.
Re:1041 pages of PHP? (Score:2)
It's pretty cheap to give the web designer a book and say "read this", especially when there's no sensitive data on the line.
Course, it's probably cheaper to pay some Indian folks to do it.
Re:1041 pages of PHP? (Score:2)
As to your off hand remark about India there are plenty of developers in the States that would gladly code a website. The problem is they demand competitive wages [not slave labour rates].
So yeah, if you're company is small then you outsource for developers. You don't just cut corners and have your janitor develop your website...
Tom
Re:1041 pages of PHP? (Score:2)
There is no reason for most websites to deal with anything more than a session identifier to keep your browsing preferences. IF that.
Re:1041 pages of PHP? (Score:2)
Still my main point stands. The bulk of these programming books are just recycles with a new lang behind it.
Tom
Re:1041 pages of PHP? (Score:2)
I don't know of any corporate web site that doesn't require programming.
If a site is important and complex enough to require a web designer, it will also require a web programmer.
Re:1041 pages of PHP? (Score:2)
Re:1041 pages of PHP? (Score:3, Interesting)
If you want to learn comp.sci there are better books then some jackass reference manual for a programing language.
In reality you could put the PHP grammar on a few pages or so [the C one takes like 4-5 pages in the K&R book] then proceed to show off examples of PHP being used fo