note 119415 added to function.method-exists
| From: | jave | Date: | Wed, 01 Jun 2016 17:15:11 +0000 |
| Subject: | note 119415 added to function.method-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205633@lists.php.net to get a copy of this message | ||
The function does not care about class existance, so you can use it to check an existance of a
method even when class was not declared e.g.
<?php
if( method_exists('THIS_WAS_NOT_DECLARED', 'some_method') )
echo "it does exist!";
else
echo "nope, it is not there...";
?>
...raises no errors/warnings... outputs "nope, it is not there..." if class does not exist
at all or if it does but the method doesn't.
----
Server IP: 72.52.91.14
Probable Submitter: 2a00:1028:83a0:227e:4cf1:fc48:158a:b3c3
----
Manual Page -- http://php.net/manual/en/function.method-exists.php
Edit -- https://master.php.net/note/edit/119415
Del: integrated -- https://master.php.net/note/delete/119415/integrated
Del: useless -- https://master.php.net/note/delete/119415/useless
Del: bad code -- https://master.php.net/note/delete/119415/bad+code
Del: spam -- https://master.php.net/note/delete/119415/spam
Del: non-english -- https://master.php.net/note/delete/119415/non-english
Del: in docs -- https://master.php.net/note/delete/119415/in+docs
Del: other reasons-- https://master.php.net/note/delete/119415
Reject -- https://master.php.net/note/reject/119415
Search -- https://master.php.net/manage/user-notes.php