This article mainly introduces how PHP uses the get_class_methods() function to obtain classification. It analyzes the usage skills of the get_class_methods() function to obtain member methods in the class based on examples. Friends who need it can refer to it
<?php /* * Created on 2016-7-20 */ class Window //首先定义一个类 { var $state; //窗户的状态 function close_window() //关窗户方法 { $this->state="close"; //窗户的状态为关 } function open_window() //开窗户方法 { $this->state="open"; //窗户的状态为开 } } $temp=get_class_methods("Window"); echo "类Window中的方法有以下几个:"; echo "<p>"; for($i=0;$i<count($temp);$i++) { echo $temp[$i].","; } ?>
The running results are as follows:
The methods in class Window are as follows:
close_window, open_window,
Summary: The above is The entire content of this article is hoped to be helpful to everyone's study.
Related recommendations:
Detailed explanation of PHP form submission and processing of form data
PHP serialization and deserialization Example analysis
PHP object-oriented programming OOP inheritance usage detailed explanation
The above is the detailed content of PHP uses get_class_methods() function to obtain classification method example analysis. For more information, please follow other related articles on the PHP Chinese website!