RE: [PHP] PHP is a Bloated Kludge, discuss!
| From: | Maxim Maletsky \(PHPBeginner.com\) | Date: | Fri, 05 Oct 2001 01:35:30 +0000 |
| Subject: | RE: [PHP] PHP is a Bloated Kludge, discuss! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-70004@lists.php.net to get a copy of this message | ||
Of cource changing the require with include would explain everything :-)
Sorry, forgot to mention that :-)
Maxim Maletsky
www.PHPBeginner.com
> -----Original Message-----
> From: Maxim Maletsky (PHPBeginner.com)
> [mailto:php-general@phpbeginner.com]
> Sent: venerdì 5 ottobre 2001 3.33
> To: 'Opec Kemp'; php-general@lists.php.net
> Subject: RE: [PHP] PHP is a Bloated Kludge, discuss!
>
>
> > > PHP on the other hand seems to load in ALL the code that
> > MAY be run.
> > > i.e. an include brings things in which are inside an if,
> > even if the
> > > if equates to false.
> >
> > A quick check in the manual, it states that:
> >
> > "Unlike include(), require() will always read in the target
> > file, even if the line it's on never executes. If you want to
> > conditionally include a file, use include(). The conditional
> > statement won't affect the require(). However, if the line on
> > which the require() occurs is not executed, neither will any
> > of the code in the target file be executed. "
> > http://www.php.net/manual/en/function.require.php
> > and
> > http://www.php.net/manual/en/function.require-once.php
> >
> >
> > So to do what you said i.e. conditionally load the
> > function/files that you want then you should use include().
> > http://www.php.net/manual/en/function.include.php
> > and
> > http://www.php.net/manual/en/function.include-once.php
> >
> > So I don't buy this agument.
>
> This is outdated. Look int othe archives - I had this
> discussion with Zeev close to a year ago - since PHP
> 4.0.(something) require and include behaves in the exactly same way.
>
> Test it yourself on the latest release of PHP:
>
>
> require.test.php
> ----
> <?
>
> echo 'included?';
>
> if($go)
> require 'require.error.test';
>
> ?>
> ----
>
> require.error.test
> ----
> <?
>
> echo '<H1>yup!</H1>';
>
> parse error;
>
> ?>
> ----
>
> Access it with:
> 1. require.test.php?go=e
>
> And then try it with:
> 2. require.test.php
>
>
> What do you buy now?
>
>
> Maxim Maletsky
> www.PHPBeginner.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail:
> php-general-help@lists.php.net To contact the list
> administrators, e-mail: php-list-admin@lists.php.net
>
>