Re: [PHP] break statement usage

2002-01-26 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then DL Neil blurted
> Private note: heard the one about throwing stones and living in glass houses?
> 
> > 
> > Try to keep your posts a little shorter
> > if only for the sake of the dialup users ;)
> > 

> this said by someone who:
> - pushes MIME messages into a discussion list/newsgroup (instead of simple text 
>format which is
> almost-universally preferred/required/recommended on lists),

er... I'm only sending text.

> - has a (unnecessary) PGP addendum on every msg sent,

That's a matter of opinion only.

> - frequently ends up sending msgs which open as blank screens, until certain email 
>client users make the extra
> effort of opening an attachment (a virus risk in most 'warnings/good practices' 
>descriptions)

I'd be very interested to hear if anybody is getting this from me. As
far as I know There is *nothing* wrong with my messages. Perhaps there
is somthing wrong with 'Outhouse' on your machine :-)

 
> but whose contributions are often much appreciated!

er Thanks, I think?

- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8UsxnHpvrrTa6L5oRAs1rAJ9jLdFD3CaJ/FtKT5oW1/aJwcANdQCbBO8l
raX1o6ZBDirdcUpqo9C6+mA=
=yAGV
-END PGP SIGNATURE-

-- 
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] break statement usage

2002-01-26 Thread DL Neil

Private note: heard the one about throwing stones and living in glass houses?

> 
> Try to keep your posts a little shorter
> if only for the sake of the dialup users ;)
> 

this said by someone who:
- pushes MIME messages into a discussion list/newsgroup (instead of simple text format 
which is
almost-universally preferred/required/recommended on lists),
- has a (unnecessary) PGP addendum on every msg sent,
- frequently ends up sending msgs which open as blank screens, until certain email 
client users make the extra
effort of opening an attachment (a virus risk in most 'warnings/good practices' 
descriptions)

but whose contributions are often much appreciated!

Regards,
=dn
(whose 'crimes' include the use of (some) M$ products)



- Original Message -
From: "Nick Wilson" <[EMAIL PROTECTED]>
To: "PHP" <[EMAIL PROTECTED]>
Sent: 25 January 2002 21:24
Subject: Re: [PHP] break statement usage


> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
>
> * and then Erik Price blurted
> > So what I'm wondering is,
> >
> > Is it bad coding practice to make heavy use of "break" statements in
> > switch() flow control?
>
> That's exactly the point of the break statement, it was designed to be
> used in a switch statement to 'break' from the statement.
> It replaces the need for complex and untidy 'if else' monsters.
>
> 
> Try to keep your posts a little shorter
> if only for the sake of the dialup users ;)
> 
>
> Cheers
> - --
>
> Nick Wilson
>
> Tel: +45 3325 0688
> Fax: +45 3325 0677
> Web: www.explodingnet.com
>
>
>
> -BEGIN PGP SIGNATURE-
> Version: GnuPG v1.0.6 (GNU/Linux)
>
> iD8DBQE8Uc0PHpvrrTa6L5oRAvcAAJ9Z67PVwgyNN7WFpf/R0wvN97IMkgCgm53O
> 1TbPTWhwyl8FNEhtLRRYv/c=
> =UDbQ
> -END PGP SIGNATURE-
>
> --
> 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]




Re: [PHP] break statement usage

2002-01-25 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then Erik Price blurted
> On Friday, January 25, 2002, at 04:24  PM, Nick Wilson wrote:
> >
> >Try to keep your posts a little shorter
> >if only for the sake of the dial-up users ;)
> >
> 
> Do you suggest this tip whenever someone includes the contents of the 
> last ten messages of a thread as quoted material below their three lines 
> of response?
Occasionally. The point of threading is /follow/ a conversation not
build upon it each time by repeating. Generally accepted net etiquette
is to quote only what is necessary for someone picking up a thread in
the middle to get the general idea. (and of course to quote the points
you are responding to :)

> In fact, a couple of times over the course of this week I've opened an 
> email from Nick Wilson saying "Please post more information about your 
> problem if you want us to help you."  Which I think is appropriate, and 

Sure, it's always a Q. of balance.

> I'm not criticizing you for this.  But it takes a few extra seconds out 

Are you certain?

> of everyone's day to read messages like this, even those of us with high 
> speed access.  Don't you agree that if everyone took a few more words to 
> say what they mean, we'd actually save a bit of bandwidth in the long 
> run?

I just thought your post was a little over detailed for what you were
actually asking. I didn't mean to cause offense hence the friendly way
of expressing my point as opposed to the 'well I'm not actually swearing
so it's OK to flame people right?' approach.

- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8UdqNHpvrrTa6L5oRAk+uAJ0SNZlwSwNSZhH1ZS9QY7/SSZeaYQCglGUU
37Ft88fX/JWfm/hs2oaRGP0=
=lkSa
-END PGP SIGNATURE-

-- 
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] break statement usage

2002-01-25 Thread Erik Price


On Friday, January 25, 2002, at 04:24  PM, Nick Wilson wrote:
> 
> Try to keep your posts a little shorter
> if only for the sake of the dialup users ;)
> 
>


Thanks for the tip, but I find that a more verbose message makes 
explicit what I am asking.  How many times have you seen "I break my 
code with this error message:  (error message.)  Please help meEee!!!" 
and that's it.

Do you suggest this tip whenever someone includes the contents of the 
last ten messages of a thread as quoted material below their three lines 
of response?

In fact, a couple of times over the course of this week I've opened an 
email from Nick Wilson saying "Please post more information about your 
problem if you want us to help you."  Which I think is appropriate, and 
I'm not criticizing you for this.  But it takes a few extra seconds out 
of everyone's day to read messages like this, even those of us with high 
speed access.  Don't you agree that if everyone took a few more words to 
say what they mean, we'd actually save a bit of bandwidth in the long 
run?


Cheers,
Erik


-- 
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] break statement usage

2002-01-25 Thread Nick Wilson

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1


* and then Erik Price blurted
> So what I'm wondering is,
> 
> Is it bad coding practice to make heavy use of "break" statements in 
> switch() flow control?

That's exactly the point of the break statement, it was designed to be
used in a switch statement to 'break' from the statement.
It replaces the need for complex and untidy 'if else' monsters.


Try to keep your posts a little shorter 
if only for the sake of the dialup users ;)


Cheers
- -- 

Nick Wilson

Tel:+45 3325 0688
Fax:+45 3325 0677
Web:www.explodingnet.com



-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.6 (GNU/Linux)

iD8DBQE8Uc0PHpvrrTa6L5oRAvcAAJ9Z67PVwgyNN7WFpf/R0wvN97IMkgCgm53O
1TbPTWhwyl8FNEhtLRRYv/c=
=UDbQ
-END PGP SIGNATURE-

-- 
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] break statement usage

2002-01-25 Thread Darren Gamble

Good day,

Actually, using the "break" statement is the accepted, proper way to break
out of a switch statement, just as it is in other programming languages.

And yes, the "break" statement can be used to terminate other loops, such as
"while" and "for", just like in other languages.  Using it there is not
considered bad programming practice either, although in the case of the
while statement you should try to utilize the loop condition if possible.
FYI, the command to break to the next iteration of a loop is "continue".

The PHP site has very good documentation on the usage and appropriateness
for "switch", "break" and "continue".  I would highly recommend you take a
look, if you have not already.


Darren Gamble
Planner, Regional Services
Shaw Cablesystems GP
630 - 3rd Avenue SW
Calgary, Alberta, Canada
T2P 4L4
(403) 781-4948


-Original Message-
From: Erik Price [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 25, 2002 2:11 PM
To: PHP
Subject: [PHP] break statement usage


Hello, all

I have a quick question about using the "break" statement from within a 
switch() statement.

After accepting user input from a form, I want to run this input through 
some error checking via PHP code (not Javascript error checking).  So 
the first thing is the code puts the input through to a couple of error 
functions (this is all inside of a switch statement that is determined 
by a radio button on the previous page).  If the error functions show 
the input as invalid, I echo back a specific error-message telling the 
user which field needs to be fixed, and then "break" to end the case 
statement.  That way the input never comes near the database functions 
(mysql_query()) if it is invalid input.

Is this a poor way to code -- using the "break" as a shortcut to jump 
out of the switch statement?  Are there other ways that "break" can be 
used -- such as from loops?  I've been learning Python on the side, and 
in that language, the "break" statement is used often, sometimes in a 
loop like

while 1
   do some code
   if condition is true
  break

This is basically an infinite loop until the condition is true -- though 
I've never seen a WHILE loop in PHP that is formed this way (using a 1 
to make it happen infinitely until a condition is met and then BREAKing 
out of the loop).  Usually, at least from what I've seen, PHP WHILE 
loops are constructed so that they terminate when a condition is met 
specified immediately after the WHILE, as in:

while (x < $number_of_iterations) {
 do some code
}

So what I'm wondering is,

Is it bad coding practice to make heavy use of "break" statements in 
switch() flow control?

Thank you for your opinions,

Erik


-- 
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]