note 107225 added to function.class-exists

From: Date: Tue, 17 Jan 2012 21:06:54 +0000
Subject: note 107225 added to function.class-exists
Groups: php.notes php.notes 
Request: Send a blank email to php-notes+get-185684@lists.php.net to get a copy of this message
@ Annymous and myb at mikebevz dot com either method should work fine as in the case below. Something else must be wrong <?php namespace MyNameSpace { Class MyClass { public function myFunction() { return class_exists( '\Test' ); } public function myFunction2() { return class_exists( '\\Test' ); } } } namespace { Class Test {} //Hack to show I was loading the correct class on php.net note $myClass = "MyNameSpace\MyClass"; $myClass = new $myClass; var_dump( $myClass->myFunction() ); //returns bool(true) var_dump( $myClass->myFunction2() ); //returns bool(true) } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 173.8.63.13 ---- Manual Page -- http://www.php.net/manual/en/function.class-exists.php Edit -- https://master.php.net/note/edit/107225 Del: integrated -- https://master.php.net/note/delete/107225/integrated Del: useless -- https://master.php.net/note/delete/107225/useless Del: bad code -- https://master.php.net/note/delete/107225/bad+code Del: spam -- https://master.php.net/note/delete/107225/spam Del: non-english -- https://master.php.net/note/delete/107225/non-english Del: in docs -- https://master.php.net/note/delete/107225/in+docs Del: other reasons-- https://master.php.net/note/delete/107225 Reject -- https://master.php.net/note/reject/107225 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#185684) next »