It's Friday - what a day to visit jfoobar!

 

Goto PHP 5.3

When I started programming I had to manually encode the processor instructions on my Zilog Z80 microprocessor. In the years to follow new procedural languages came available and I have coded a lot using those languages. Early 90's I learned about object orientation and and design patterns during the various courses I followed. From the start I was educated that using a goto statement was bad practice. One of the first writings about how bad goto statements are was done by Edsger W. Dijkstra in the Communications of the ACM, Vol. 11, No. 3, March 1968, pp. 147-148. A goto statement easily creates dead code, and most of all it is very difficult to follow the program flow when goto statements are used, I agree fully with the statement that goto statements are bad practise.

Almost 30 years later we use modern programming languages like C, Java, Ruby and PHP. I never have had the need to use a goto statement in any of my programs, and the lack of the availability of this statement in PHP was even never noticed by me, until I was notified that the goto statement has been added to PHP 5.3...how bizar?

A hilarious bug report can be found in the PHP tracker, an even subtile and funny reply can be found in the PHP documentation page where the goto statement is explained, the image below taken from xkcd says it all ;-)

XKCD image about using a goto statement

About the author Wilco Jansen

Wilco was born in 1967 in the Netherlands where he still lives. After years of being a programmer Wilco has worked as project manager and IT manager. Discovered Joomla! when he was creating his own content management system, and never lost focus after then. Joined core team as development coordinator in May 2006 just helping to make Joomla! even better then it is already. Wilco has been deeply involved in the Joomla project as Google summer of code program manager 2006, 2007 and 2008 editions, co-organizer of the Google Highly Participation contest in 2008, first ever development coordinator, creator of the Joomla bug squad, member of the board of Open source matters, regular speaker on world wide conference advocating Joomla and much, much more. Wilco has a bachelor degree in business and information engineering and studied Master of Science knowledge and information engineering at the Middlesex University in London.

More about Wilco Jansen

There are 5 comments posted.

Re: Welcome back

# 1 - Posted by: Brian Teeman on 2009-08-07 14:14:47

Welcome back to the blogging world. I hope that this post means that you and the rest of the jfoobar bloggers will be posting again on a daily basis. Kind of feel lost without something good to read with my morning coffee. I've tried to take up some of the slack ;)

# 2 - Posted by: Wilco Jansen on 2009-08-07 14:24:53

Always good that we are being missed :-D

Past weeks, and also upcoming months our focus will be Abillo, in the mean while we will try to write some blogs...enough topics, to little time ;-)

# 3 - Posted by: Frank Welgemoed on 2009-08-07 18:45:01

And now we will wait for the ALTER statement.

This was a statement in earlier years, what could change the goto during the execution of the program.

(All in favor of programming in a tiny memory environment, but impossible to retrace when you are due to change the program's code)

# 4 - Posted by: Frank Welgemoed on 2009-08-07 18:47:50

By the way the link : "Communications of the ACM, Vol. 11, No. 3, March 1968, pp. 147-148." is wrong (http://jfoobar.org/%20 in front of the right link)

# 5 - Posted by: Wilco Jansen on 2009-08-07 19:29:11

Link has been corrected.

The ALTER statement could be used in COBOL and I remember it would lead to resignation when you used it. PHP is a very different language compared to COBOL, and it provides all kinds of Mechanism to alter the logic, not sure the following would work:

$label = 'JumpHere';

goto $label;

This would mimic the ALTER statement...hope you don't mind I will not test it :-D

Help for creating beautiful comments.

Enter Your Details:
Enter Your Comments:
I'm finished with the form Your form will be checked and you'll get a preview.
moovur promo

Blogging team

We have a team that works on the blogs presented on this site. Below you will find all present members who are actively working on blogs on this site.


Please contact us if you are interested in helping us out with the creation of the blogs.

Post translations

jfoobar has readers from all over the world and in many languages. If you create a translation of one of our posts and link to it than please let us know so we can add a link back to the translation at the original post.

JFoobar friends on Twitter

Follow JFoobar on twitter

Sponsored Links

Latest Comments

Aaron wrote:
2009-12-23 13:19:22 - Genius! Thanks, Wilco. I've been dying to take .
Posted in How to downlo .
Amy Stephen wrote:
2009-12-22 18:39:37 - Happy Birthday to one of Joomla!'s most noble - .
Posted in Mister Joomla .
Antonie de Wilde wrote:
2009-12-22 09:30:26 - Congrats Robin. Have a good day and watch out w .
Posted in Mister Joomla .
Robert wrote:
2009-12-22 08:51:02 - Happy Birthday Robin .
Posted in Mister Joomla .
Arno wrote:
2009-12-22 08:43:28 - Happy Birthday Robin, love your suit, you wife .
Posted in Mister Joomla .
Brian Teeman wrote:
2009-12-22 00:17:41 - Happy Birthday Robin, Welcome to the big four oh .
Posted in Mister Joomla .