Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

learning OO with PHP

I've started to learn OO programming, but using the PHP language with the help of the "PHP 5 Objects, Patterns, and Practice" book. The thing is that I wish to learn to use into same time the CakePHP framework which make use a lot of the MVC pattern. Because I don't know much about OO and less about MVC I wish to understand the later one but assumptions I make with my OO knowledges might have bad impact on long term.

Does anyone know a good tutorial about what means MVC (more than cakephp manual says about it, but more easy to read/understand than wikipedia)?

TY

like image 441
dole doug Avatar asked Apr 18 '10 11:04

dole doug


People also ask

Can you do OOP in PHP?

PHP - What is OOP? From PHP5, you can also write PHP code in an object-oriented style. Object-Oriented programming is faster and easier to execute.

Is OOP in PHP difficult?

Learning PHP OOP from procedural programming is a bit tricky for me. I almost gave up but the demand for reusability kept me going. The concept of class and object seemed difficult for me, but after many attempts and approaches, I was able to get the concepts and the implementation.

Which oops concept is used in PHP?

Class is one of the most critical OOPs Concepts in PHP. A class can have any number of instances or objects. All the objects of a class will have access to all the data members and member functions of that class.

What is PHP programming why it is called OOPS programming?

PHP is a server-side scripting language, mainly used for web development but also used as a general-purpose programming language. Object-Oriented Programming (PHP OOP), is a type of programming language principle added to php5, that helps in building complex, reusable web applications.


2 Answers

Here is an excellent PHP MVC tutorial on phpro.org to get you started.. I had trouble with MVC design pattern too but after reading this tutorial, I learned so much that I went on creating my own PHP MVC framework. (and yes I have re-invented the wheel but guess what, I learned a looooot and that was my primary reason).

Although you are already reading a book related to PHP OOP but yet I would recommend you going this great OOP tutorial at phpfreak

like image 111
Sarfraz Avatar answered Oct 04 '22 01:10

Sarfraz


If you are just looking to find out more about MVC, why not checkout a book on design patterns? Since MVC is just a design pattern, most pattern books will contain it and much more. Design pattern books are a good read if you are starting on OO topics as well. You could checkout Martin fowlers online pattern catalog or checkout a book like Headfirst design patterns

like image 27
Mark Story Avatar answered Oct 04 '22 01:10

Mark Story