Edit report at https://bugs.php.net/bug.php?id=60697&edit=1

 ID:                 60697
 Comment by:         a at b dot c dot de
 Reported by:        hfcorriez at gmail dot com
 Summary:            gettype() cann't distinguish object and function?
 Status:             Not a bug
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   all
 PHP Version:        5.3.8
 Block user comment: N
 Private report:     N

 New Comment:

If you want to tell if something is a function (i.e. callable), use 
is_callable(). If you want to tell if something is an object and callable, use 
is_object and is_callable().


Previous Comments:
------------------------------------------------------------------------
[2012-01-10 08:44:19] hfcorriez at gmail dot com

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"

------------------------------------------------------------------------
[2012-01-10 08:20:50] cataphr...@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

Reply via email to