Re: Jason Wong->Array help

From: Date: Mon, 28 Jul 2003 17:39:24 +0000
Subject: Re: Jason Wong->Array help
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-157214@lists.php.net to get a copy of this message
* Thus wrote Ryan A (ryan@jumac.com): > > one last question: > According to the script I am calling an include file... > eg: > if(r=2){include "blah1.php";} > elseif (r=3){include "blah2.php";} > and so on.... > > now blah1,2,3 etc are mostly html code files with php in them.....will this > slow down performance a lot and be much of a strain? the calling files are > not large...maybe around 12k each...The reason I choose to go this way of > course is for easier readibilty ,handleing and space management. Whats your > experience with this? good or bad? Well, if it is a big loop then that means that many more hits to the disk (not taking any sort of disk/php/zend caching into consideration.) which is a high price to pay. I would create something like blah2.php: function blah2_html() { //output html.... } and use include_once() in your if statment and call the function Personally I would also use the switch statement instead of a if elesif block for readability: switch ($r) { case 2: include_once('blah1.php'); blah1_html(); break; case 3: include_once('blah3.php'); blah3_html(); break; } Curt -- "I used to think I was indecisive, but now I'm not so sure."

« previous php.general (#157214) next »