This is an old revision of the document!
PHP RFC: get_debug_type
- Version: 1
- Date: 2020-02-15
- Author: Mark Randall, firstname.lastname@example.org
- Status: Under Discussion
- First Published at: https://wiki.php.net/rfc/get_debug_type
This RFC proposes to add a new function get_debug_type that will return the given type of a variable.
This function would differ from gettype in that it would return native type names, e.g. “int” rather than “integer” and would automatically resolve class names.
- 0 => int (gettype: integer)
- 0.1 => float (gettype: double)
- true => bool (gettype: boolean)
- false => bool (gettype: boolean)
- “hello” => string
-  => array
- null => null (gettype: NULL)
- A class with name “Foo\Bar” => foo\bar (previously: object)
- An anonymous class => class@anonymous (previously: object)
- A resource => resource (xxx) (previously: resource)
- A closed resource => resource (closed)
Backward Incompatible Changes
Proposed PHP Version(s)
Proposed Voting Choices
Yes / no vote on adding the new function.
Yes / no on resource names be resolved - Would appear as resource(resource_type).
(Optional) A vote on the name, if there is not a clear majority consensus during RFC discussion.
Initial discussion @ https://github.com/php/php-src/pull/5143