Bug #60697 [Bgs]: gettype() cann't distinguish object and function?
Edit report at https://bugs.php.net/bug.php?id=60697&edit=1
ID: 60697
User updated by: hfcorriez at gmail dot com
Reported by: hfcorriez at gmail dot com
Summary: gettype() cann't distinguish object and function?
Status: Bogus
Type: Bug
Package: Scripting Engine problem
Operating System: all
PHP Version: 5.3.8
Block user comment: N
Private report: N
New Comment:
I think it's not good for use
When I want to check function and call witch $a(), I must check it's a object and
the class name is "Closure"
Previous Comments:
------------------------------------------------------------------------
[2012-01-10 08:20:50] cataphract@php.net
"function" is not a type. See http://php.net/manual/en/language.types.php
------------------------------------------------------------------------
[2012-01-10 05:25:13] hfcorriez at gmail dot com
Description:
------------
I create a lambda function with a variable, then check it type with gettype , it's
return "object", It think it's not good in here.
Test script:
---------------
$a = function(){};
$b = new stdClass();
echo gettype($a) . '|' . gettype($b); // echo 'object|object'
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=60697&edit=1
Thread (4 messages)