You are here: Re: Public response to P Pulkkinen « PHP Programming Language « IT news, forums, messages
Re: Public response to P Pulkkinen

Posted by Kimmo Laine on 02/01/07 13:43

"Captain Paralytic" <paul_lautman@yahoo.com> wrote in message
news:1170328792.349222.6920@l53g2000cwa.googlegroups.com...
> On 1 Feb, 11:14, "P Pulkkinen"
> <perttu.POISTATAMA.pulkki...@POISTATAMA.elisanet.fi> wrote:
>> Dear A Kaufman, I can't IMAGINE what you mean by this post in one
>> previous
>> thread.
>>
>> =================================================
>> "An include/require will be included no matter what.
>>
>> For example:
>> <?php
>> if(TRUE){
>> include "myfile.php";} else {
>>
>> include "yourfile.php";}
>>
>> ?>
>>
>> In the above example - BOTH files will be included no matter what."
>> =================================================
>>
>> This is NOT OF COURSE the case!
>>
>> http://perttu.finote.com/muuta/test.php
>>
>> Here I have in same folder files myfile.php and yourfile.php, other one
>> echoing
>> This text comes from file myfile.php
>> and other one echoing
>> This text comes from file yourfile.php
>>
>> but OF COURSE test.php prints only "This text comes from file
>> myfile.php"
>
> He did not say that the contents of both files would be executed, he
> said that both files would be included. The if/then/else statement
> will ensure that the contents of yourfile.php do not get executed,
> however they WILL be included.

A proper way to test it might be including a HUGE (like Donald Trump Huge) a
file and see if there's a performance peak... like this:

<?php

$started = time();

if(FALSE){
require('my_huge_1Gb_bogus_file.php');
}
echo 'elapsed = '.(time()-$started);

?>

I'm thinking if elapsed time jumps thru the roof, then the file was accessed
and read into memory, but not executed thou. my_huge_1Gb_bogus_file.php
could just be <?php /* LOL OMG THIS IS A TEST LOL OMG THIS IS A TEST LOL OMG
THIS IS A TEST .... */ ?> repeated a zillion times so that the file size
would actually become gigantic.

Another thing is that if you use require and a non-existing file, php
doesn't throw an error if the require statement is unreachable, like behind
if(FALSE), only when the file really is included in the code.

--
"Ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" - lpk
http://outolempi.net/ahdistus/ - Satunnaisesti pδivittyvδ nettisarjis
spam@outolempi.net | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация