I have n php object like this:
$test
->key1(1)
->key2(1)
->key3(1);
Is it possible to add a condition inside it?
like this:
$test
if(true) ->key1(1)
->key2(1)
if(true) ->key3(1);
I have n php object like this:
$test
->key1(1)
->key2(1)
->key3(1);
Is it possible to add a condition inside it?
like this:
$test
if(true) ->key1(1)
->key2(1)
if(true) ->key3(1);
what you want is
if (condition) {
code to be executed if this condition is true;
} elseif (condition) {
code to be executed if this condition is true;
} else {
code to be executed if all conditions are false;
}
for example
if ($YOUR_KEY == "key1") {
//if key1 then do something
} elseif ($YOUR_KEY == "key2") {
//if key2 then do something
} else {
//if none condition work than do something else
}
here $YOUR_KEY
is your variable and "key1"
is your value
check www.w3schools.com and http://php.net/manual for reference