|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2000-09-13 19:16 UTC] ping at alt dot it
gettype() on function names returns null Although undocumented, in version 3 it properly returned 'user function'. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Sun Jun 14 07:00:01 2026 UTC |
It WAS undocumented but working on php3. It IS documented and doesn't work on php4 <? class class1 { function classfunction1() { $b=2; } } $myclass=new class1; echo "classfunction1 is of type ", gettype($myclass->classfunction1),"<br>\n"; ?>more examples: <? $z=33; function normal() { $a=1; } class class1 { function classfunction1() { $b=2; } } $myclass=new class1; echo "myfunction is of type ", gettype($myclass->classfunction1),"<br>\n"; echo "b is of type ", gettype($myclass->b),"<br>\n"; echo "z is of type ", gettype($z),"<br>\n"; echo "normal is of type ", gettype($normal),"<br>\n"; echo "class1 is of type ", gettype($class1),"<br>\n"; echo "myclass is of type ", gettype($myclass),"<br>\n"; echo "classfunction1 is of type ", gettype($classfunction1),"<br>\n"; ?> this piece of code, run both on PHP 3.0.12 and PHP 4.0.2 gives these different results: ouput by PHP 3 .0.12: myfunction is of type user function b is of type string z is of type integer normal is of type string class1 is of type string myclass is of type object classfunction1 is of type string output by PHP 4.02: myfunction is of type NULL b is of type NULL z is of type integer normal is of type NULL class1 is of type NULL myclass is of type object classfunction1 is of type NULL