• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Basic PHP questions

Vegitto

Diamond Member
Just a couple of questions from a noob 😛..

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 🙂.
 
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.


 
Back
Top