Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of Python's dir function in PHP

Tags:

python

php

Is there any equivalent method of Python's dir() in PHP? It would be really nice if I could see what method(s) are associated with a certain data type or class.

like image 416
Saifullah Alam Avatar asked Apr 17 '15 21:04

Saifullah Alam


People also ask

What is the dir () function in python?

Python dir() Function The dir() function returns all properties and methods of the specified object, without the values. This function will return all the properties and methods, even built-in properties which are default for all object.

What is __ DIR __ python?

Python dir() The function dir python is responsible for returning the valid list of the attributes for the objects in the current local scope. For example: If an object of a method called is named as __dir__(), the function must return a list of attributes that are associated with that function.

What is HELP () and dir ()?

Help() and dir(), are the two functions that are reachable from the python interpreter. Both functions are utilized for observing the combine dump of build-in-function. These created functions in python are truly helpful for the efficient observation of the built-in system.

What is difference between HELP () and dir () functions?

The dir function returns a list of all the attributes within in an object - these could be either data values or methods, and the list includes private and magic methods. The help function works by formatting all of the docstrings from the object with other data into a hopefully useful help page.


1 Answers

Afaik PHP has no equivalent to just dir, but you can get such information with functions like get_class_methods: http://php.net/manual/en/ref.classobj.php

like image 173
Felk Avatar answered Oct 28 '22 07:10

Felk