What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP Help

PHP Help
Author: Message:
KeyStorm
Elite Member
*****

Avatar
Inn-sewer-ants-pollie-sea

Posts: 2156
Reputation: 45
38 / Male / –
Joined: Jan 2003
RE: PHP Help
Die(a) is the same as

print(a);
exit;

ie: it sends the argument to the output and then ends the script execution

code:
switch($random)
{
case 1:
echo 'I knew it was gonna be 1';

case 2:
echo 'Who\'d say it was gonna be 2';

default:
echo 'I couldn\'t guess it';
}


If $random is 1, This switch runs from case 1 and also runs case 2 and default since nothing stops the interpreter.

code:
switch($random)
{
case 1:
echo 'I knew it was gonna be 1';
break;

case 2:
echo 'Who\'d say it was gonna be 2';
break;

default:
echo 'I couldn\'t guess it';
break;
}


In this case only case 1 is run and then the switch is exited by break

code:
switch($random)
{

default:
echo 'I couldn\'t guess it';
break;

case 1:
echo 'I knew it was gonna be 1';
break;

case 2:
echo 'Who\'d say it was gonna be 2';
break;
}


Even in this case, default will only be run if $random is neither 1 nor 2. You have to mind the break's the rest is just as it's supposed to work.

This post was edited on 03-02-2005 at 09:56 PM by KeyStorm.
03-02-2005 09:45 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
PHP Help - by DJeX on 03-02-2005 at 03:44 AM
RE: PHP Help - by fluffy_lobster on 03-02-2005 at 06:06 PM
RE: PHP Help - by DJeX on 03-02-2005 at 09:30 PM
RE: PHP Help - by KeyStorm on 03-02-2005 at 09:45 PM
RE: PHP Help - by fluffy_lobster on 03-03-2005 at 10:34 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On