当前位置:网站首页>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 .
边栏推荐
- No more! Technical team members resign collectively
- Yyds dry inventory hcie security Day12: concept of supplementary package filtering and security policy
- Brief analysis of ref nerf
- Global and Chinese market of recycled yarn 2022-2028: Research Report on technology, participants, trends, market size and share
- treevalue——Master Nested Data Like Tensor
- [gd32l233c-start] 5. FLASH read / write - use internal flash to store data
- MySQL——索引
- The post-90s resigned and started a business, saying they would kill cloud database
- Hcie security Day12: supplement the concept of packet filtering and security policy
- Redis data migration (II)
猜你喜欢

仿网易云音乐小程序

A little understanding of GSLB (global server load balance) technology

Getting started with postman -- built-in dynamic parameters, custom parameters and assertions
![[secretly kill little buddy pytorch20 days -day02- example of image data modeling process]](/img/14/8ab1f1fb142e10dead124851180d03.jpg)
[secretly kill little buddy pytorch20 days -day02- example of image data modeling process]

Redis concludes that the second pipeline publishes / subscribes to bloom filter redis as a database and caches RDB AOF redis configuration files

Why use pycharm to run the use case successfully but cannot exit?

treevalue——Master Nested Data Like Tensor

Borui data and Sina Finance released the 2021 credit card industry development report

Design e-commerce seckill system

Day 9 HomeWrok-ClassHierarchyAnalysis
随机推荐
JS three families
抓包整理外篇——————autoResponder、composer 、statistics [ 三]
Decompile and modify the non source exe or DLL with dnspy
Transformer structure analysis and the principle of blocks in it
Visiontransformer (I) -- embedded patched and word embedded
Mysql - - Index
Monkey/ auto traverse test, integrate screen recording requirements
Base ring tree Cartesian tree
MySQL - idea connects to MySQL
"Designer universe" APEC safety and health +: environmental protection Panda "xiaobaobao" Happy Valentine's Day 2022 | ChinaBrand | Asia Pacific Economic media
Décompiler et modifier un exe ou une DLL non source en utilisant dnspy
鹏城杯 WEB_WP
淺析 Ref-NeRF
内存分析器 (MAT)
What is the content of the securities practice examination?
Etcd 基于Raft的一致性保证
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.
Redis data migration (II)
Software testing skills, JMeter stress testing tutorial, obtaining post request data in x-www-form-urlencoded format (24)
How to install sentinel console