thanks for your answers! i'm not quite sure if i made my point clear. this is my problem:
image.php <? header("Content-type: image/png"); $image = imagecreate(510, 510); $color = ImageColorAllocate($image, 0, 0, 0);
include("database.php");
ImagePNG($image, '', 95); imagedestroy($image); ?>
database.php <? imageline($image, 420, 468, 308, 372, $color); imageline($image, 132, 154, 146, 144, $color); imageline($image, 420, 318, 440, 180, $color); imageline($image, 418, 474, 476, 320, $color); imageline($image, 418, 474, 476, 324, $color); [...] ?>
instead of including the whole database.php i need to include only a given number of lines, always starting with the first one.
because database.php contains 10'000+ lines and therefore also the number of lines to include may be pretty high i don't know if importing the lines into a variable is a good idea.
This really begs the question of WTF you have a 10,000+ line file that you only need a couple lines from... seems like your logic is screwy.
Anyhow, you have two solutions, each of which have been presented to you already. Either fopen() the file and read the lines you need, then eval() them, or copy the lines you need to another file and include that.
Like Chris mentioned, if you must keep your program running this way, using a filesystem call to copy X lines to a new file may be your fastest method.
Hate to repeat what's already been said, but those are your options. Post back with specific questions when/if one of these do not work for you.
-- ---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php