Thread: arrays......
View Single Post
Old 04-17-2009, 02:13 PM   #18 (permalink)
allworknoplay
The Gregarious
 
allworknoplay's Avatar
 
Join Date: Feb 2009
Location: New York
Posts: 645
Thanks: 64
allworknoplay is on a distinguished road
Default

I made my FOR LOOP a little cleaner...it works this way too...
I am open to suggestions to make it even better...

Maybe using SWITCH might be a little faster?

Code:
for($i=0;$i<=$count;$i++) {

	
if(($get_page - 2) == $array[$i]) $array2[] = $array[$i];
if(($get_page - 1) == $array[$i]) $array2[] = $array[$i];
if($get_page == $array[$i]) $array2[] = $array[$i];
if(($get_page + 1) == $array[$i]) $array2[] = $array[$i];
if(($get_page + 2) == $array[$i]) $array2[] = $array[$i];
	
}
allworknoplay is offline  
Reply With Quote