note 97164 modified in function.get-class by danbrown

From: Date: Tue, 06 Apr 2010 14:19:00 +0000
Subject: note 97164 modified in function.get-class by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-167728@lists.php.net to get a copy of this message
If you are using namespaces this function will return the name of the class including the namespace, so watch out if your code does any checks for this. Ex: namespace Shop; <?php class Foo { public function __construct() { echo "Foo"; } } //Different file include('inc/Shop.class.php'); $test = new Shop\Foo(); echo get_class($test);//returns Shop\Foo ?> --was-- If you are using namespaces this function will return the name of the class including the namespace, so watch out if your code does any checks for this. Ex: namespace Shop; class Foo { public function __construct() { echo "Foo"; } } //Different file include('inc/Shop.class.php'); $test = new Shop\Foo(); echo get_class($test);//returns Shop\Foo http://php.net/manual/en/function.get-class.php

« previous php.notes (#167728) next »