note 119972 added to function.is-a

From: Date: Fri, 30 Sep 2016 14:19:13 +0000
Subject: note 119972 added to function.is-a
Groups: php.notes 
Request: Send a blank email to php-notes+get-206712@lists.php.net to get a copy of this message
Please note that you have to fully qualify the class name in the second parameter. A use statement will not resolve namespace dependencies in that is_a() function. <?php namespace foo\bar; class A {}; class B extends A {}; ?> <?php namespace har\var; use foo\bar\A; $foo = new foo\bar\B(); is_a($foo, 'A'); // returns false; is_a($foo, 'foo\bar\A'); // returns true; ?> Just adding that note here because all examples are without namespaces. ---- Server IP: 72.52.91.14 Probable Submitter: 212.63.81.20 ---- Manual Page -- http://php.net/manual/en/function.is-a.php Edit -- https://master.php.net/note/edit/119972 Del: integrated -- https://master.php.net/note/delete/119972/integrated Del: useless -- https://master.php.net/note/delete/119972/useless Del: bad code -- https://master.php.net/note/delete/119972/bad+code Del: spam -- https://master.php.net/note/delete/119972/spam Del: non-english -- https://master.php.net/note/delete/119972/non-english Del: in docs -- https://master.php.net/note/delete/119972/in+docs Del: other reasons-- https://master.php.net/note/delete/119972 Reject -- https://master.php.net/note/reject/119972 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206712) next »