Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9046 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99639 invoked by uid 1010); 11 Apr 2004 21:16:18 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99585 invoked from network); 11 Apr 2004 21:16:18 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 11 Apr 2004 21:16:18 -0000 Received: from [192.168.1.105] (p508EB984.dip.t-dialin.net [80.142.185.132]) by shiva.mind.de (Postfix) with ESMTP id 465F197B4F; Sun, 11 Apr 2004 23:16:17 +0200 (CEST) Date: Sun, 11 Apr 2004 23:16:32 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <16439436171.20040411231632@marcus-boerger.de> To: Marc Richards Cc: internals@lists.php.net In-Reply-To: <20040411054722.44141.qmail@pb1.pair.com> References: <20040411054722.44141.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] PHP4 -> PHP5 incompatibility - classes must be declared before being used From: helly@php.net (Marcus Boerger) Hello Marc, Sunday, April 11, 2004, 7:47:23 AM, you wrote: > Hi All, > I have a couple question re: {subject}. > Can anybody point me to some info on why this change was neccessary (not > complaining, just curious). I did some searching and it seems to relate > to objects that use interfaces...but that is all I could find. If it is > too complex to explain that is fine; I just want to know whether I > should keep looking or not. The new OO features of PHP 5 made that necessary. Generally if you do not use any of them (interfaces, abstract, final) the engine will (should) still be able to do everything at compile time so that you can use your classes before usage. > Are there any edge cases where it would not be impossible to satisfy > this requirement...say some complex interdependence between two or more > classes. Sorry I know this is very hand-wavvy but I don't have enough > OOP experience to come up with a good example. > I read that for simple cases, instantiation before declaration will > work...does/will this cause an E_STRICT error? no but probabla something to discuss since maybe later it won't work anymore and it is 'not so good practise' or better say not recommended usage. > The primary reason for my curiosity is that I recently started putting > PHP functions that only get used on one page at the end of the page (and > therefore calling the function before it is defined). While this > greatly enhanced readibility, I was a little wary of this method, > especially since I haven't really seen anybody else doing it. Is there > an inherent problem with this method for functions? I guess the > alternative would be to put it an included file (even though it is only > included on one page). Is that what most people do? I guesso but includes of course come with some speed penalty. > Along those lines, is there any performance penalty for using > __autoload() to load my php classes if I am using a code cache like APC? Ask george > Does __autoload() work for functions? nope -- Best regards, Marcus mailto:helly@php.net