phpView object methods: First create a PHP sample file; then define a class; finally print out all method names in the object through the "var_dump(get_class_methods($a));" method.
Recommended: "PHP Video Tutorial"
PHP View all method names in the object
There are many methods in a class. Sometimes you are not sure which method to use for processing. You can print them all out and it will be clear at a glance what methods a class has.
<?php class a { public $a = 1; public function __construct() { } public function aaa() { echo "a"; } public function get_name() { } } $a = new a(); var_dump( get_class_methods( $a ) );
Print results:
0 => string '__construct' (length=11) 1 => string 'aaa' (length=3) 2 => string 'get_name' (length=8)
The above is the detailed content of How to view object methods in php. For more information, please follow other related articles on the PHP Chinese website!