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_integer

Summary

Returns TRUE if the provided variable is an integer.

Usage

input|is_integer( 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 integer. 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=3}
 
{if $my_variable|is_float()}
    It is an integer.
{else}
    It is not an integer.
{/if}

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

Example 2

{def $my_variable=3}
 
{if is_float( $my_variable )}
    It is an integer.
{else}
    It is not an integer.
{/if}

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

Example 3

{def $a=3
     $b='Mobile instrument.'}
 
{if $a|is_float( $b )}
    It is an integer.
{else}
    It is not an integer.
{/if}

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

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

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


Comments

  • examples should use is_integer instead of is_float

    In the examples you use the 'is_float' operator although this is the docu for the operator is_integer. The results should still be the same however.