Need help regarding php

Hitterman

New Member
Need help regarding php

I was coding a vBulletin pHp file and I am confused a bit.

When we use case in php, does it works same as it works in C++? I mean, if we declare a case in php like this:
Code:
[FONT=Courier New][COLOR=#007700]switch([/COLOR][COLOR=#0000bb]$_GET[/COLOR][COLOR=#007700][value[/COLOR][COLOR=#007700]])[/COLOR][/FONT]
and then we will call it
Code:
case 1:
<code>
break;

Will it work?

Can somebody please explain me switch case in PHP? I am really confused after reading some tutorials.
 
Re: Need help regarding php

Yeah, it works in the same way as in C++.

The syntax is as follows
Code:
switch($var)
{
case value1:
    ....
    break;

case value2:
    ....
    break;

default:
    .....
}
 
Re: Need help regarding php

This sounds good. I've been motivating myself towards learning PHP too and if the majority of the language is similar to C++ I don't think it would be that tough...
 
Re: Need help regarding php

It's not a tough language to learn at all if you've done any c++, java etc. I'm trying to start learning Django/Python and it makes PHP look like cake
 
Re: Need help regarding php

I have learnt all the basics of C++ and I am still learning it. I also wanted to learn good PHP since I am a coder also.

Thankyou AB for giving me the support. :)
 
Re: Need help regarding php

I am a n00b to PHP as of now, but I'm hoping to catch on in some months time. For now I'm concentrating on strenghthening my base at C++ and then we'll look at php...
 
Re: Need help regarding php

Now days, PHP is also important like C++ since it is used in building WebPages. There are many websites providing Tutorials & Resources on PHP.

I have started learning PHP along with C++ & VB. Kshitiz, you can easily learn PHP since you are excellent in VB and C++.

EDIT: AB, Can you tell me does "curl" function require "PHP safe mode enabled"?
 
Re: Need help regarding php

Hitterman;281008 said:
I was coding a vBulletin pHp file and I am confused a bit.

When we use case in php, does it works same as it works in C++? I mean, if we declare a case in php like this:
Code:
[FONT=Courier New][COLOR=#007700]switch([/COLOR][COLOR=#0000bb]$_GET[/COLOR][COLOR=#007700][value[/COLOR][COLOR=#007700]])[/COLOR][/FONT]
and then we will call it
Code:
case 1:
<code>
break;

Will it work?

Can somebody please explain me switch case in PHP? I am really confused after reading some tutorials.
If you are finding these things too hard you might be better off going to the vbulletin forums and ask on there as they also know what to do.
You can actually put it in as a string and it is easier.
 
Re: Need help regarding php

schwab2clarkson;281861 said:
If you are finding these things too hard you might be better off going to the vbulletin forums and ask on there as they also know what to do.
You can actually put it in as a string and it is easier.
His query was related to PHP, not specifically related to vBulletin and I doubt he found it too hard as he posted the correct syntax himself.
 
Re: Need help regarding php

His query was related to PHP, not specifically related to vBulletin and I doubt he found it too hard as he posted the correct syntax himself.
Though I asked it for vBulletin, but my main objective was to clear my doubt regarding switch case in PHP.

I asked at vB.org but they haven't explained me well.

Thankyou AB.
 
Back
Top