Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19081 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42665 invoked by uid 1010); 19 Sep 2005 17:01:55 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 42649 invoked from network); 19 Sep 2005 17:01:55 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2005 17:01:55 -0000 X-Host-Fingerprint: 81.169.182.136 ajaxatwork.net Linux 2.4/2.6 Received: from ([81.169.182.136:40619] helo=strato.aixcept.de) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id A6/E0-43379-20FEE234 for ; Mon, 19 Sep 2005 13:01:55 -0400 Received: from [192.168.1.3] (dsl-082-083-224-151.arcor-ip.net [82.83.224.151]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by strato.aixcept.de (Postfix) with ESMTP id 64A9435C37E; Mon, 19 Sep 2005 19:25:10 +0200 (CEST) Date: Mon, 19 Sep 2005 19:01:55 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <663787220.20050919190155@marcus-boerger.de> To: Jason Sweat Cc: Xuefer , internals@lists.php.net In-Reply-To: <5c287472050919095831a7d525@mail.gmail.com> References: <5c287472050919081831930aea@mail.gmail.com> <28139bc05091909035260e6a6@mail.gmail.com> <5c287472050919095831a7d525@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] unable to create class from constant From: helly@php.net (Marcus Boerger) Hello Jason, new doesn't expect a string which a constant in fact is. It expects a class name. Thus the class name cannot be constified. You'd need to use reflection for that: $r = new ReflectionClass($name); $o = $r->newInstance(); best regards marcus Monday, September 19, 2005, 6:58:31 PM, you wrote: > On 9/19/05, Xuefer wrote: >> wrong list. :) > My question was not "how do I work around this?". I included that in > my original post. My question was "why is it like this?" which I > thought was more germane to the internals list. > An unquoted string would have to first be thought of as the class > name, but if that does not exist, php is not then checking to see if > it is actually a defined constant. > My questions was basically is this a performance issue or just an > undesired behavior for some other reason? > > Regards, > Jason > http://blog.casey-sweat.us/ > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php Best regards, Marcus