Re: [PHP] Re: Hmmm?
You wrote: > additionally I also tend to always provide an alternative, especially if dealing > with nested ifs or loops, even if just a comment... call it habit (from where I > don't know). > > if($condition){ > do this > }else{ > # oops, $condition didn't exist > } > > saves a hell of alot of time when going back through the code 6 months later > trying to remember what was being done where. personal opinion mind you It's a good idea. The only problem is when you come upon a situation where you don't want to do anything "else" at that point. Where you simply want to skip the rest of the if block if the condition isn't true, and continue on with the rest of your script. Then, using an else isn't what you want to do. -- -Ryan :: ICQ - 595003 :: GigaBoard - http://www.gigaboard.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: Hmmm?
oh man... it gives me such a headache when i have to try and make sense of scripts with no indentation (or arbitrary indentation)... it's always fun dealing with things like this :-) if ($this){ print " hi ";} else {print " bye "; } > -Original Message- > From: Fredrik Arild Takle [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, August 01, 2001 12:58 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Re: Hmmm? > > > I think it's impossible to read/understand my own scripts if i don't do it. > > Do: > >if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > instead of: > > if ($submit) { > echo "Counting from 1-32"; > for ($ii = '1'; $ii <= '32' $ii++) { > echo $ii." "; > } > } > echo "All done!"; > ?> > > Best Regards > Fredrik A. Takle > > "Keith Jeffery" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Simply indent formatting for readability. I personally don't indent after > > the > > > > > "Kyle Smith" <[EMAIL PROTECTED]> wrote in message > > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Whenever i get a php script off a website why is it that most of the main > > parts in the script have a space from the left border. eg > > > > > echo"spazzz"; > > ?> > > > > > > > > -lk6- > > http://www.StupeedStudios.f2s.com > > Home of the burning lego man! > > > > ICQ: 115852509 > > MSN: [EMAIL PROTECTED] > > AIM: legokiller666 > > > > > > > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]