当前位置:网站首页>How PHP gets all method names of objects
How PHP gets all method names of objects
2022-07-03 21:35:00 【Yisu cloud】
php How to get all method names of objects
This article “php How to get all method names of objects ” Most people don't quite understand the knowledge points of the article , So I made up the following summary for you , Detailed content , The steps are clear , It has certain reference value , I hope you can gain something after reading this article , Let's take a look at this article “php How to get all method names of objects ” Article bar .
stay php in , have access to get_class_methods() Function to get all the method names of the object , This function can get the specified class ( object ) All method names of , And form an array of method names to return , grammar “get_class_methods($obj)”.

The operating environment of this tutorial :windows7 System 、PHP7.1 edition 、DELL G3 The computer
stay php in , have access to get_class_methods() Function to get all the method names of the object .
get_class_methods() Function to get the specified class ( object ) All method names of , And form an array . If something goes wrong , Then return to null.
<?php
class Website {
public $name, $url, $title;
// method 1
public function demo1() {
return (true);
}
// method 2
function demo2() {
return (true);
}
// method 3
function demo3() {
return (true);
}
}
// Instantiate objects
$student = new Website();
$methods = get_class_methods($student);
var_dump($methods);
Expanding knowledge : How to get the current class name and method name ?
Want to get the current class name and method name , You can use magic constants “__CLASS__”、“__FUNCTION__” and “__METHOD__”
__CLASS__: Current class name ( Include the scope or namespace of the class );since PHP 5 This constant returns the name of the class when it is defined ( Case sensitive ). stay PHP 4 The value in is always lower case .
__FUNCTION__: The current function ( Or method ) The name of ;__METHOD__: Current method name ( Including the name of the class );Returns the name of the method when it was defined ( Case sensitive ).
That's about “php How to get all method names of objects ” The content of this article , I believe we all have a certain understanding , I hope the content shared by Xiaobian will be helpful to you , If you want to know more about it , Please pay attention to the Yisu cloud industry information channel .
边栏推荐
- 鹏城杯 WEB_WP
- 抓包整理外篇——————autoResponder、composer 、statistics [ 三]
- Qualcomm platform WiFi update disconnect end open event
- Common SQL sets
- QFileDialog
- Day 9 HomeWrok-ClassHierarchyAnalysis
- The post-90s resigned and started a business, saying they would kill cloud database
- Great gods, I want to send two broadcast streams: 1. Load basic data from MySQL and 2. Load changes in basic data from Kafka
- No more! Technical team members resign collectively
- 十大券商开户注册安全靠谱吗?有没有风险的?
猜你喜欢
![抓包整理外篇——————autoResponder、composer 、statistics [ 三]](/img/bf/ac3ba04c48e80b2d4f9c13894a4984.png)
抓包整理外篇——————autoResponder、composer 、statistics [ 三]

Yyds dry goods inventory TCP & UDP

Etcd raft Based Consistency assurance
![抓包整理外篇——————autoResponder、composer 、statistics [ 三]](/img/bf/ac3ba04c48e80b2d4f9c13894a4984.png)
抓包整理外篇——————autoResponder、composer 、statistics [ 三]

Redis data migration (II)

Software testing skills, JMeter stress testing tutorial, obtaining post request data in x-www-form-urlencoded format (24)

What should the future of the Internet be like when Silicon Valley employees flee the big factory and rush to Web3| Footprint Analytics

(5) User login - services and processes - History Du touch date stat CP

Après 90 ans, j'ai démissionné pour démarrer une entreprise et j'ai dit que j'allais détruire la base de données Cloud.
![[vulnhub shooting range] impulse: lupinone](/img/27/b92eeceefd1c71f19d926bdd1eee8b.jpg)
[vulnhub shooting range] impulse: lupinone
随机推荐
Capture de paquets et tri du contenu externe - - autoresponder, composer, statistiques [3]
Advanced collaboration: coroutinecontext
Netfilter ARP log
A little understanding of GSLB (global server load balance) technology
Study diary: February 14th, 2022
Goodbye 2021, how do programmers go to the top of the disdain chain?
鹏城杯 WEB_WP
treevalue——Master Nested Data Like Tensor
Talk about daily newspaper design - how to write a daily newspaper and what is the use of a daily newspaper?
Global and Chinese market of telematics boxes 2022-2028: Research Report on technology, participants, trends, market size and share
Analyse de REF nerf
Transformer structure analysis and the principle of blocks in it
Pengcheng cup Web_ WP
An expression that regularly matches one of two strings
MySQL - SQL injection problem
Advanced technology management - how to examine candidates in the interview and increase the entry probability
MySQL——SQL注入问题
Volley source code analysis
MySQL - idea connects to MySQL
Hcie security Day11: preliminarily learn the concepts of firewall dual machine hot standby and vgmp