alextaylor Posted August 13, 2009 Share Posted August 13, 2009 Hello I am sure this is a pretty simple one for you guys but here goes.. I would like to execute 20 php pages one after the other. I tried doing this with iframes but thought php might be a better idea, thanks in advance for any help Link to comment https://forums.phpfreaks.com/topic/170126-multiple-page-execution/ Share on other sites More sharing options...
hostingon Posted August 13, 2009 Share Posted August 13, 2009 You can use eval() function to generate loop to 20 pages with include statesment. For example; for($i=0;$i<21;$i++){ eval ("include \"page".$i.".php\";"); sleep(1); // wait 1 second only if you need this... } Link to comment https://forums.phpfreaks.com/topic/170126-multiple-page-execution/#findComment-897590 Share on other sites More sharing options...
mikesta707 Posted August 13, 2009 Share Posted August 13, 2009 why wouldn't you just use the include function... make an array of your pages you want to include, and iterate through the array foreach ($pageArray as $page){ include($page); sleep(1); } is the eval function better in any way? faster perhaps? Link to comment https://forums.phpfreaks.com/topic/170126-multiple-page-execution/#findComment-897595 Share on other sites More sharing options...
codesolid Posted August 13, 2009 Share Posted August 13, 2009 ... is the eval function better in any way? faster perhaps? No. There is no reason to use eval. Link to comment https://forums.phpfreaks.com/topic/170126-multiple-page-execution/#findComment-897597 Share on other sites More sharing options...
hostingon Posted August 13, 2009 Share Posted August 13, 2009 Yes - eval is not the fastest method - but you have 250 rows you will save php code space in your script. Eval is very usefull way when you have needs to pass many lines. Link to comment https://forums.phpfreaks.com/topic/170126-multiple-page-execution/#findComment-897602 Share on other sites More sharing options...
mikesta707 Posted August 13, 2009 Share Posted August 13, 2009 what are you talking about? he has 20 pages... and if he puts them into 1 array, the lines of code it takes to include every page is like 3-5 Link to comment https://forums.phpfreaks.com/topic/170126-multiple-page-execution/#findComment-897611 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.