Home > Backend Development > PHP Tutorial > PHP uses get_class_methods() function to obtain classification method example analysis

PHP uses get_class_methods() function to obtain classification method example analysis

墨辰丷
Release: 2023-03-29 09:58:02
Original
1945 people have browsed it

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].",";
}
?>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template