You are here: Re: problem while including two scripts... « All PHP « IT news, forums, messages
Re: problem while including two scripts...

Posted by Carl on 12/29/05 02:35

Leszek wrote:
> Included -yes but I need to make sure that prog1.php is done before
> prog2.php starts
>
> Thanks.
> Leszek
>
>

Leszek,

Simply put, php programs are actually scripts which get interpreted from
the top down ( barring any inline methods ).

A simple example I think will illustrate your problem (or lack thereof).
The code for the 3 scripts is below.

//file test.php
<?php

include("test.inc-1.php");
include("test.inc-2.php");

echo "<br />Done!";

?>


//file test.inc-1.php
<?php

for ($x = 0; $x < 100; $x++) {
for ($y = 0; $y < 50; $y++) {
echo '- ';
}

echo '<br />';
}

?>


//file test.inc-2.php
<?php

echo '<br /> Now in test.inc-2.php';

?>


If you run the script 'test.php' you will see that all of the output
generated from test.inc-1.php is produced before the output from
test.inc-2.php. I don't think that there is any question which script
takes longer to run.

Does this answer your question, or is there something I am missing.

Cheers,
Carl.

 

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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация