get_type

Summary

Returns the type of the target variable.

Usage

$input|get_type( test )

Parameters

NameTypeDescriptionRequired
test any Variable to check. Only if input is omitted.

Returns

string containing info about variable

Description

This operator can be used to check the type of a variable. The operator returns the type of the input or the first parameter. The operator returns a string.

If both input and parameter are supplied, it is the parameter that will be evaluated.

If the data is an object, the string 'object' and the name of the class will be returned.

If the data is an array, the string 'array' and the array count will be returned.

If the data is a string, the string 'string' and the lenght of the string will be returned.

Examples

Example 1

{let my_variable="ich bin" your_variable=array( "du", "bist" ) }

{$my_variable|get_type( $your_variable )}

{/let}

returns the string: "array[2]".

Example 2

{let my_variable="ich bin" your_variable=array( "du", "bist" ) }

{$your_variable|get_type( $my_variable )}

{/let}

returns the string: "string[7]".

Comments

log in or create a user account to comment.

Contents

Reference

Database diagram
Template operators
    PDF
    Arrays
    Data extraction
    Formatting
    Images
    Logic
    Mathematics
    Miscellaneous
    Strings
    URLs
    Variables
       float
       get_class
       get_type
       count
       int
       is_array
       is_boolean
       is_class
       is_float
       is_integer
       is_null
       is_numeric
       is_object
       is_set
       is_string
       is_unset
Template functions
Data fetching
Modules
XML tags


Created

05/02/2004
1:30:10 pm
by Balazs Halasy

Last updated

11/02/2004
11:14:27 am
by Balazs Halasy

Authors

Balazs Halasy



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.