Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19077 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16663 invoked by uid 1010); 19 Sep 2005 15:55:04 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 16648 invoked from network); 19 Sep 2005 15:55:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Sep 2005 15:55:04 -0000 X-Host-Fingerprint: 69.60.120.90 iconoclast.caedmon.net Linux 2.4/2.6 Received: from ([69.60.120.90:48068] helo=iconoclast.caedmon.net) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 07/6E-43379-85FDE234 for ; Mon, 19 Sep 2005 11:55:04 -0400 Received: from localhost ([127.0.0.1]) by iconoclast.caedmon.net with esmtp (Exim 3.35 #1 (Debian)) id 1EHNxJ-00058V-00; Mon, 19 Sep 2005 11:53:21 -0400 Message-ID: <432EDF5F.20602@caedmon.net> Date: Mon, 19 Sep 2005 11:55:11 -0400 User-Agent: Mozilla Thunderbird 1.0.6 (Windows/20050716) X-Accept-Language: en-us, en MIME-Version: 1.0 To: jason.sweat@gmail.com CC: internals@lists.php.net References: <5c287472050919081831930aea@mail.gmail.com> In-Reply-To: <5c287472050919081831930aea@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] unable to create class from constant From: sean@caedmon.net (Sean Coates) > But I was wondering if anyone could enlighten me as to why php would > be upset interpreting the constant as the class name. Thanks. class Foo { function get_name() { return 'Foo'; } } class Bar { function get_name() { return 'Bar'; } } define('Foo', 'Bar'); $C = new Foo(); echo $C->get_name(); // output: Foo // you might have been expecting: Bar This "issue" also affects static method calls: Foo::get_name(); // returns: Foo // even though Foo (the constant) resolves to: Bar HTH. S