I am using php in combination with ant to create a small automated build
process.  Will php run sequentially?  What I mean is I have a series of
modules or tasks:
Example:

//check out files
include("modules/checkout.php")

//zip up the files
include ("modules/zip.php")

etc

Will php wait to execute the zip.php until the checkout.php has completed
because in my priliminary tests, it doesn't appear to do this.  If not,
what's the best way to execute it?


http://www.php.net/manual/en/function.include.php
Without objects, PHP runs through each file sequentially. So if checkout.php is a sequential file it will execute those lines of code before trying to include the zip.php file, etc. If your modules use classes (which I assume they do) then you can explicitly control program flow in the main file, e.g.


mainfile.php:
// Load the class libraries
include 'modules/checkout.php';
include 'modules/zip.php';

// Now we have classes Checkout and Zip available to mainfile
$checkout = new Checkout();
$zip = new Zip();

$checkout->firstMethod();
$zip->secondMethod();
$zip->fourthMethod($checkout->thirdMethod());

If you are using classes, then creating the objects in the main file and calling the methods there as well make it easy to understand later.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to