ibexa

Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.

and

Summary

Evaluates all parameters until one is found to be FALSE, returns that value.

Usage

and( value1 [, value2 [, ... ] ] )

Parameters

NameTypeDescriptionRequired
value1 any A variable/value to be evaluated. Yes.
value2 any Another variable/value to be evaluated. No.

Returns

One of the parameters or TRUE (see below).

Description

This operator evaluates all parameters until one of them is found to be FALSE. The operator will then return that parameter and thus stop evaluating the rest of the parameters. If none of the parameters are found to be FALSE, the operator will return TRUE. The following table shows how the different types are evaluated by this operator.

Type

Evaluation

Number

TRUE if the value is non-zero, FALSE otherwise.

String

TRUE if the string consists of at least one character, FALSE otherwise.

Boolean

TRUE if the boolean is a TRUE value, FALSE is otherwise.

Array

TRUE if the array has one or more elements, FALSE otherwise.

Object

TRUE if the object provides the "attributes" and the "attribute" methods, FALSE otherwise.

NULL

Always FALSE.

Other

Other types will be evaluated in the same way as PHP would do.

Examples

Example 1

{if and( false(), true(), false() )}
    The truth is out there.
{else}
    The day the earth stood still.
{/if}

The following output will be produced: "The day the earth stood still.".

Example 2

{def $a=array()
     $b=array( 1, 2, 3 )
     $c=array( 4, 5, 6 )}
 
{and( $a, $b, $c )}

The code above will return the empty array that is represented by $a.

Balazs Halasy (05/02/2004 10:38 am)

Balazs Halasy (04/05/2005 2:01 pm)


Comments

There are no comments.