Basic PHP questions

Vegitto

Diamond Member
May 3, 2005
5,234
1
0
Just a couple of questions from a noob :p..

I want to do the following things:

if $var == 'bla1', $hey == 'hello'

Or something like that..

In other words, if a certain variable has a pre-specified value, another variable gets another value.

Also:

include('$somevar')

In other words, if $somevar is http://www.google.com, I want google.com to be included. If it's yahoo.com, I want yahoo.com to be included, etc, etc.

Thanks :).
 

jdport

Senior member
Oct 20, 2004
710
0
71
Simply use an if statement...


if ($var=='value') $setme="hello";

or in your example
if ($url=='http://www.google.com') $include='google';
else if ($url=='http://www.yahoo.com') $include='yahoo';
else $include='default';

note that you use == when you're doing a comparison to check that two things are equal,
as opposed to = when you are assigning a value to a variable.