What book should I use to learn Object Orietented PHP for web programming?
I开发者_JS百科 am new to PHP but have good OOP idea. I am looking for a good PHP book the Guides to Develop Website in OOP Style. I have purchased some books that all use Procedural approach to develop the website, or there are few book that show OOP chucks not a complete Webdevelopment Guide.
I need some book(source) that leeds me from Start 2 End of a website in OOP fashion.
The comments above touch-base on this, but I figured I would give a definite "answer" to your question.
The reason you have been having trouble finding a book that shows how to code PHP in an OOP fashion, is that it isn't capable of being programmed that way. At least not alone. PHP is a hybrid language that can do objects, but doesn't have to do objects.
Now, there are a LOT of PHP frameworks out there that help reinforce OOP standards in PHP. It is here that you may find books that are more OO-centric. But any book out there that claims to teach raw OOP PHP isn't worth reading.
If you learned OOP first, as more than a few people are doing today, you have a hard road ahead. You are going to need to unlearn what you have learned about Objects to be able to get PHP. It is a mix. It is a cobbled-together mass of everything in one giant pot.
This power comes at the sacrifice of formality and standards. OOP is about sacrifice of power for formality and standards.
Good luck.
EDIT
To expand on how PHP is not OO alone.
What I mean is that, as I said later in the answer, using a framework that helps enforce OOP principals can make PHP function like other OOP languages, or at least more closely like it.
I should also clarify my C++ not being OOP comment. C++ is in exactly the same boat as PHP, only it has been around long enough that OO has become a true standard and is well-practices throughout the industry at large. PHP doesn't have this. There are almost no strictly OO large-scale applications built in PHP. Working with strict OO standards in PHP on the high-end will grind your application to a hault.
Compare with real OOP languages/frameworks. Ruby, Smalltalk, so on. Or even almost-totally OO languages like Java and C#.
I would recommend this book:
Matt Zandstra - PHP Objects, Patterns and Practice, Third Edition
It is largely OOP focused, at the same times it sheds light on the shortcomings/limitations of OOP in PHP.
"Object-Oriented PHP" is a book: http://objectorientedphp.com/
精彩评论