|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2013-08-03 11:48 UTC] 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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 06 05:00:01 2026 UTC |
It was due at the fact that is_callable() don't handle namespaces, my script in header looks like: <?php namespace Cert; function algunaFuncion() { echo "Desde alguna funcion. . ."; } $variableFuncion = __NAMESPACE__.'\algunaFuncion';//Now I added the namespace constant var_dump(is_callable($variableFuncion, false, $nombre_a_llamar)); // bool(true) echo $nombre_a_llamar, "\n"; ?> Prepending namespace constant all works fine. I didn't think that namespace would affect to is_callable() function. I know one more thing... Thank you very much.