first_set
Summary
Returns the first parameter that is set (or FALSE).Usage
first_set( value1 [, value2 [, ... ] ] )
Parameters
Name | Type | Description | Required |
---|---|---|---|
value1 | any | A variable/value that should be evaluated. | Yes. |
value2 | any | Another variable/value that should be evaluated. | No. |
Returns
The first value that is set or FALSE.Description
This operator evaluates all parameters until one of them is found to be set. The parameter that is found to be set will be returned. If none of the parameters are set, the operator will return FALSE.
Examples
Example 1
{if first_set( $a, $b, $c )} The truth is out there. {else} The day the earth stood still. {/if}
As long as $a, $b and $c are undeclared/unset, the following output will be produced: "The day the earth stood still".
Example 2
{first_set( $a, 256, $b )}
As long as $a is undeclared/unset, the following output will be produced: "256".
Balazs Halasy (05/02/2004 10:40 am)
Balazs Halasy (04/05/2005 2:07 pm)
Comments