
Statement then. default can go anywhere it wants, I prefer it at the top because it's much more easier to organize my cases:rolleyes:switch isn't a function.
:rolleyes:
If your going to make a tutorial, at least code it well, indentation, having default at the bottom, using strings in your get array.
oh denta just said the exact same thing... thats like a teacher teaching you to code in tables -- you shouldn't do it.
Back for a while.
I'm pretty sure theres an easier way to do this same thing.. with less code. but i maybe wrong.. **looks on computer for it**
Originally Posted by bananasislegend
this thread might be better than sex..
convo with Celeb and I, talking about this.(23:20) James -> Nicole: $_GET[page]
(23:20) James -> Nicole: what a ...
(23:21) James -> Nicole: wops
(23:21) James -> Nicole: i usually look at the bottom 4 the default
(23:21) TehUpload: same
(23:21) TehUpload: that's where it goes
(23:21) TehUpload: because it says
(23:21) TehUpload: if it is this, bla.
if it is this, bla.
if it isn't either one, bla (default)
(23:21) TehUpload: not
(23:22) TehUpload: if it is neither one, bla (default)
if it is this, bla.
Hi, names James. I am a web developer.
PHP Code:switch($_GET ["type"]) {
case "about" :
$core->template->parseTemplate( "about" );
break;
case "contact" :
$core->template->parseTemplate( "contact" );
default :
$core->template->parseTemplate( "index" );
break;
}
That would parse 2 templates when you use contact.
visit my internet web site on the internet
http://dong.engineer/
it is just videos by bill wurtz videos you have been warned
oops forgot that break.
PHP Code:switch($_GET ["type"]) {
case "about" :
$core->template->parseTemplate( "about" );
break;
case "contact" :
$core->template->parseTemplate( "contact" );
break;
default :
$core->template->parseTemplate( "index" );
break;
}
Obviously as pointed out above you can drop-through cases, e.g:
case "lol" would drop through what and thing and echo lol, so would what, and also thing.PHP Code:switch( $_GET['act'] )
{
case 'lol':
case 'what':
case 'thing':
echo('lol');
break;
default:
echo('default');
break;
}
visit my internet web site on the internet
http://dong.engineer/
it is just videos by bill wurtz videos you have been warned
Pointing out above, expanding what Dan said, you can use default and index as the same way, and drop-through the cases.
Caleb correct me if I'm wrong, isn't it bad to have spacing like
$_GET ["var"]
Between the T and square left bracket? I don't know...
I think we should try and conform to pear.php.net's standards, they are quite good. I'm sick of everybody adding whitespace and parenthesis EVERYWHERE to make it look 'pretty'..
Whitespace and unecessary characters should only be used where it makes it easier to read, and less to type, IMO.
How could this hapen to meeeeeeeeeeeeeee?lol.
I don't type the spaces, I don't type any of the formatting.
I have a nice little too called Ctrl+Shift+F which does it all for me, to phpDoc standards.. which are highly acceptable
pear's standards are laughed at, and are only used for pear repository coding, not a standard for coding.
Want to hide these adverts? Register an account for free!