Break n

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Break n

Post by anjanesh »

The paramter for Break is a nice thing and wanted to use it. But Im not getting it to work.

Code: Select all

<?php
if (1==1)
{
if (2==3)
 echo "2=3";
else
 break 1;

echo "1==1";
}
?>
By the way the basic break which can be done in C also doesn't work in if {} blocks

Code: Select all

if (2==2)
{
break;
}
Any way to solve this ? Or wasnt this the original intention of using break in php ?
Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

break doesn't work for anything outside loops... last I checked..
Post Reply