Questions about common and static methods in PHP classes

Source: Internet
Author: User
<? PHP  /*  Product  */  Class  Product {  Public   Static   $ Count = 0 ;  Public   $ Name ='' ;  Public   Function  Show (){ Print ('<P> show method </P>' );}  Public   Static   Function  Display (){  Print ('<P> display static method </>' );}}  $ Class = New Reflectionclass ('product' );  Print "<PRE>" ; Reflection : Export ($ Class  );  Print "</PRE>" ; Product :: Display (); Product : Show (); //  Why can I access non-static methods in the following way? ?>
 
Class [class product] {@ D: \ webroot \ static. PHP 5-16-constants [0] {}-static properties [1] {property [public static $ count]}-static methods [1] {method [static public method display] {@ D: \ webroot \ static. PHP 13-15 }}- properties [1] {property [Public $ name]}-Methods [1] {method [public method show] {@ D: \ webroot \ static. php 9-11 }}}

Display static method

Show Method

 

The above isProgramIn the result of execution, the show method is a general method. Why can we use product: Show () for access without errors? Isn't the access from static methods the same? If so, what should I do with static methods? Which of the following gives me some advice. Thank you !!!

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.