note 118306 added to language.oop5.static

From: Date: Fri, 13 Nov 2015 10:40:00 +0000
Subject: note 118306 added to language.oop5.static
Groups: php.notes 
Request: Send a blank email to php-notes+get-204143@lists.php.net to get a copy of this message
To check if a method declared in a class is static or not, you can us following code. PHP5 has a Reflection Class, which is very helpful. try { $method = new ReflectionMethod( 'className::methodName ); if ( $method->isStatic() ) { // Method is static. } } catch ( ReflectionException $e ) { // method does not exist echo $e->getMessage(); } *You can read more about Reflection class on http://php.net/manual/en/class.reflectionclass.php ---- Server IP: 72.52.91.14 Probable Submitter: 182.71.196.49 ---- Manual Page -- http://php.net/manual/en/language.oop5.static.php Edit -- https://master.php.net/note/edit/118306 Del: integrated -- https://master.php.net/note/delete/118306/integrated Del: useless -- https://master.php.net/note/delete/118306/useless Del: bad code -- https://master.php.net/note/delete/118306/bad+code Del: spam -- https://master.php.net/note/delete/118306/spam Del: non-english -- https://master.php.net/note/delete/118306/non-english Del: in docs -- https://master.php.net/note/delete/118306/in+docs Del: other reasons-- https://master.php.net/note/delete/118306 Reject -- https://master.php.net/note/reject/118306 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#204143) next »