Doc #65381 [Opn->Nab]: Example #1 is_callable() with a mistake
Edit report at https://bugs.php.net/bug.php?id=65381&edit=1
ID: 65381
Updated by: mfonda@php.net
Reported by: jortsc at gmail dot com
Summary: Example #1 is_callable() with a mistake
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: *General Issues
Operating System: Windows 7
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
The example code on the manual page and the code below both produce the correct
result, bools(true).
Double-check your test script to make sure there are no typos. If you copy/pasted
the example from the manual, perhaps your editor messed things up when pasting. A
misspelling of 'someFunction' in your test script would result in is_callable
returning false.
Previous Comments:
------------------------------------------------------------------------
[2013-08-03 11:48:38] jortsc at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/function.is-callable#refsect1-function.is-
callable-examples
---
I'm studying for the ZCE and I found what it seems a mistake. This code does not
return true, returns false. I think the second parameter has to set to true.
I hope it will be useful.
Greetings.
Test script:
---------------
function someFunction()
{
}
$functionVariable = 'someFunction';
var_dump(is_callable($functionVariable, false, $callable_name)); // bool(true)
echo $callable_name, "\n"; // someFunction
It shows:
bool(false) someFunction
function someFunction2()
{
}
$functionVariable = 'someFunction2';
var_dump(is_callable($functionVariable, true, $callable_name)); // bool(true)
echo $callable_name, "\n"; // someFunction
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65381&edit=1
Thread (3 messages)