Jump to content

Control Structure - goto


gevans

Recommended Posts

http://www.php.net/manual/en/control-structures.goto.php

 

So what does everyone think of this new operator?

 

Introduced in PHP 5.3, it's a strange direction to take. It seems to be giving you the option to ignore good coding practice, like setting variables as 'global' inside your function, or using 'or die()' as daniel0 recently wrote about in the phpfreaks blog.

 

Even the image at the bottom of the manual page is taking the p*ss out of the new operator. Having that there is surely the PHP team admitting that it's not a best practice piece of code, but is there anywhere it could be used well? How is this any better than using the already existing if/else conditional statements?

Link to comment
https://forums.phpfreaks.com/topic/164687-control-structure-goto/
Share on other sites

Well I mean yeah I can understand how it would go in the same group as those things, filed under "bad practice" (although I still stand by my argument against die being in that category 100% of the time...) but the way he said it made it sound like that goto somehow did those things.

It seems to be giving you the option to ignore good coding practice

 

I think that made it very obvious that I was talking about bad coding, not comparing their functionality.

 

but the way he said it made it sound like that goto somehow did those things.

 

Did what things? goto sets a variable as global, or kills the script? I hardly think that's a realistic assumption, or one that could be derived from my OP

So what does everyone think of this new operator?

 

Introduced in PHP 5.3, it's a strange direction to take. It seems to be giving you the option to ignore good coding practice, like setting variables as 'global' inside your function, or using 'or die()' as daniel0 recently wrote about in the phpfreaks blog.

 

You start out by asking what we think of this new operator (as a side-note,  I'm kind of scratching my head about why they are calling it an operator..).  You then mention when it was introduced, and how it is strange.  You then say that it seems to be "giving you the option to ignore good coding practice, like setting variables as 'global' inside your function, or using 'or die()'..."

 

You clarified by saying you were giving examples of bad programming practice.  But the way you said it in your OP, you are giving examples of how it is giving you the option to ignore good coding practice.  That's how you wrote it.  That's the grammatically correct way of reading what you wrote. So I was confused and asked about it.

That's the grammatically correct way of reading what you wrote.

 

I'll admit, my english isn't fantastic, though I do live in the UK and it is my first language. I do however proof read my posts and still feel that it reads as I expected and intended.

 

It seems to be giving you the option to ignore good coding practice, like setting variables as 'global' inside your function, or using 'or die()'

 

The first thing I do is make a statement - (ignore good coding practice). Then I make comparisons to that statement. Making my two comparisons comparable to ignoring good coding practice.

 

Reads fine?

Of course it makes sense to you; you wrote it.  But anyways, my intention was not to be some kind of grammar police.  I read it and interpreted it a certain way that caused me to be confused, so I asked about it.  You clarified it.  Let's all get jiggy wid it.  Na na nana nanana.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.