PHP object-oriented programming

Source: Internet
Author: User
Yesterday I posted an article about PHP OOP written by Lu Zhanbin ~ Then I want to talk about my feelings about PHP object-oriented programming ~ I once saw someone saying: PHP and PERL are exactly the same. what should I do if I have PERL? So I will ask him, people are all the same. since there are already so many people, what do you want ?~ Maybe you want to say that everyone is not posting an article about php oop written by Lu Zhanbin yesterday ~ Then I want to talk about my feelings about PHP object-oriented programming ~

I once saw someone saying: PHP and PERL are exactly the same. what should I do if I have PERL?

So I will ask him, people are all the same. since there are already so many people, what do you want ?~ Maybe you want to say that everyone is different, that is, things are different, and even if they are the same, since they are already in the world, why is it better to survive and prove that you are better than the other?



I have been familiar with PERL and have never used it seriously. I have seen some basic things a long time ago. in my opinion, he is not familiar with Python ~ Python has a history of more than 10 years, but he does not seem to care about it. but in fact, Python is used in many places. for example, he made the installation script of the famous RedHat Lunix, and before JAVA, I don't know how long it will take to use the virtual machine ~



PHP is pure. I always think that, from the beginning to the present, it's complicated. although he is still following the big deal (......) But the reference on many networks is still limited to scripts, so he is really pure ...... Very flattering. But sometimes it will be quite uncomfortable, because it is not powerful enough. of course, if you have enough strength, you can develop your own PHP module ...... But it is obviously not worth doing this ......



Open PEAR in PHP. wow ~ :)



I was stupid enough to say that PHP has no constructor ~ It seems that I really want to say something to Chairman Mao. if you don't understand it, don't say it ......



PHP not only has constructors, but also ~ You can also easily reload constructors ~~

As follows:






Class MyClass {



Var $ MyVar;



Function MyClass (){



$ This-> MyVar = "I am izzzzzzzzzzz ";



}



}





$ Test = new MyClass;



Echo $ test-> MyVar;



?>









For more information about heavy load construction, see the previous article about heavy load construction ~



In PHP, encapsulation, inheritance, and polymorphism are all very good ~



Some may say that PHP is not a real object-oriented language, which is a fact. PHP is a hybrid language. you can use OOP or traditional procedural programming. However, for large projects, you may want/need to use pure OOP to declare classes in PHP, and only use objects and classes in your project. As the project grows, it may be helpful to use OOP, and the OOP code is easy to maintain, easy to understand and reuse. These are the basis of software engineering. Applying these concepts in web-based projects will become the key to future website success.



In fact, although OOP is the core of software engineering, if you are not doing well with the process-oriented architecture ~ So you must be unable to write the OOP code ~ Yes!



The article posted a few days ago is really good ...... It is worth reading.



The following is the connection address:



Http://www.justdn.org/justdn.v2/content.php? ID = 24



IZz Studio

2001.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.