Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.

is_array

Summary

Returns TRUE if the provided variable is an array.

Usage

input|is_array( target )

Parameters

NameTypeDescriptionRequired
target any The target variable. Only if the input parameter is omitted.

Returns

TRUE or FALSE.

Description

This operator checks if the input parameter or the target variable is an array. If it is, the operator will return TRUE, otherwise FALSE will be returned. If both the input parameter and the target variable are provided, it is the target variable that will be evaluated.

Examples

Example 1

{def $my_variable=array( 1, 2, 3 )}
 
{if $my_variable|is_array()}
    It is an array.
{else}
    It is not an array.
{/if}

The following output will be produced: "It is an array.".

Example 2

{def $my_variable=array( 1, 2, 3 )}
 
{if is_array( $my_variable )}
    It is an array.
{else}
    It is not an array.
{/if}

The following output will be produced: "It is an array.".

Example 3

{def $a=array( 1, 2, 3)
     $b='Mobile instrument.'}
 
{if $a|is_array( $b )}
    It is an array.
{else}
    It is not an array.
{/if}

The following output will be produced: "It is not an array.".

Balazs Halasy (05/02/2004 12:30 pm)

Balazs Halasy (06/05/2005 7:24 am)


Comments

There are no comments.