Xongoo!Com: Central Unit wrote:
Here's:
for ($c=1; $c<$numpages; $c++){ echo "<a href=page$c.html>$c</a> | "; }
When it generates 1-10, it is normal 0.05 s, but often I need more than 1000, so when generating 100's - it is 0.5-1.5 sec., when more than 1000 -
10+ s.
I am thinking on running sopme sort of: 1) generate code of number of pages once a day using cron, 2) store it in database, 3) show static generated code from database.
But before doing it I've thought to ask here.
-- Tadas Talaikis [EMAIL PROTECTED] http://www.xongoo.com
----- Original Message ----- From: "Robert Cummings" <[EMAIL PROTECTED]> To: "Xongoo!com: Central unit" <[EMAIL PROTECTED]> Cc: "PHP-General" <[EMAIL PROTECTED]> Sent: Saturday, August 21, 2004 7:32 PM Subject: Re: [PHP] for loops performance
On Sat, 2004-08-21 at 12:17, Xongoo!com: Central
unit wrote:
Holla,
Maybe someone knows how to improve for loops performance? When generating 1000's of pages,
it
oads in 10-20 seconds. Maybe there is some solution I don't know about?
Give us an example of your for loop that is
having efficiency problems.
Cheers, Rob.
You can do this once and instead of echoing the links, save then in a session var and use that on subsequent pages.
Maybe on first page or before in some other script:
session_start(); for ($c=1; $c<$numpages; $c++){ $_SESSION['links'] .= "<a href=page$c.html>$c</a> | "; }
Then on other pages:
session_start(); echo $_SESSION['links'];
-Shawn
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php