Re: How to Get the Sub Classes of a Parent Class

From: Date: Sun, 25 Oct 2009 15:25:27 +0000
Subject: Re: How to Get the Sub Classes of a Parent Class
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-299319@lists.php.net to get a copy of this message
2009/10/25 Raymond Irving <xwisdom@yahoo.com>: > I want to automatically initialize a specific sub class when the php page is loaded. > > I'm looking for a solution for php 5.1+ or anything that's optimized for 5.3 You may be able solve this with a simple class_exists() (pseudo-code ahead): if(class_exists($var)) { $class = new $var; } else { $class = new FourOhFour; }

« previous php.general (#299319) next »