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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

I just love the fact that they have used an XKCD comic in the manual... Brilliant. Why the devs have added goto, I have no idea. Who's ever sat there and thought "Damn, I wish I could just use a goto..."?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.