Mysidia Adoptables Support Forum

Mysidia Adoptables Support Forum (http://www.mysidiaadoptables.com/forum/index.php)
-   Questions and Supports (http://www.mysidiaadoptables.com/forum/forumdisplay.php?f=18)
-   -   Dechiphering the Adoptables Script (http://www.mysidiaadoptables.com/forum/showthread.php?t=1643)

Ansem717 01-12-2011 02:10 AM

Dechiphering the Adoptables Script
 
I'm in my learning stages of PHP. I've done a few variable manipulations and within the Adoptables Script, I've been able to add a link to the ACP within the menu bar. Hey, I think it's pretty cool that I can figure out where things are, k?

Thing is, I always am stumped upon this code:
PHP Code:

$i 0
while ($i 1) {

execute certain codes

$i
++


The above confuses me... Why would you execute codes within a while loop if you're only going to do it once? Why don't you just erase the $i variable completely? I physically see no purpose within that while statement. Can someone define this for me?

--Thanks
--Ansem717

Kaeliah 01-15-2011 06:58 PM

There are 3 possible reasons for this. First, is that while statements may actually execute quicker than if the statements were just listed. Sounds funky, but I wouldn't be surprised if that was the case. Second possibility is, as the adoptables script was originally designed be added on to, it may be that those loops are there for future add-ons. Third, is that the programmer was half asleep while typing on his keyboard. :3


All times are GMT -5. The time now is 09:48 AM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.