• News
  • Developer information
  • Projects & contributions
  • Forum
  • Issue tracker
  • Open Funding
  • Security
  • User groups
  • Support
  • Store
  • Company

  • Path

    ez.no / exponential / documentation / development / libraries / ez template / operators / type handling


    Type handling

    These documentation pages are no longer maintained. Please visit the new documentation site.

    Type checking

    These operators generally correspond to the PHP functions of the same name, where they exist.

    is_array

    Returns true if the input or the first parameter is an array. If both input and parameter are supplied, the parameter will be used.

    is_boolean

    Returns true if the input or the first parameter is a boolean (true or false). If both input and parameter are supplied, the parameter will be used.

    is_integer

    Returns true if the input or the first parameter is an integer. If both input and parameter are supplied, the parameter will be used.

    is_float

    Returns true if the input or the first parameter is a floating point number. If both input and parameter are supplied, the parameter will be used.

    is_numeric

    Returns true if the input or the first parameter is a number or a numberic string (a string consisting of numbers). If both input and parameter are supplied, the parameter will be used.

    is_string

    Returns true if the input or the first parameter is a string. If both input and parameter are supplied, the parameter will be used.

    is_object

    Returns true if the input or the first parameter is an object (as opposed to a simple type like integer or float). If both input and parameter are supplied, the parameter will be used.

    is_class

    Returns true if the input or the first parameter is a class. If both input and parameter are supplied, the parameter will be used.

    is_null

    Returns true if the input or the first parameter is null.
    Note: The integer 0 is not the same as 'null', if you want to test for 0 use

    {$var|eq(0)}

    or
    {eq($var,0)}
    instead. If both input and parameter are supplied, the parameter will be used.

    is_set

    Returns true if the first parameter is not false. is_set does not take an input.

    is_unset

    Returns true if the first parameter is false. is_unset does not take an input.

    get_type

    Returns the type of the input or the first parameter as a string. If both input and parameter are supplied,
    the parameter will be used. If the data is an object, then the string 'object' and the classname will be returned.
    If the data is an array, then the string 'array' and the array count will be returned. If the data is a string, then the string 'string' and the string length will be returned.

    get_class

    Returns the class of the input or the first parameter as a string. If both input and parameter are supplied, the parameter will be used.
    If the data is not an object, false will be returned.

    Type creators

    true

    Creates a true boolean. Remember to use brackets, e.g.

    {true()}

    false

    Creates a false boolean. Remember to use brackets, e.g.

    {false()}

    array

    Creates an array. E.g.

    array(6,8,42)

    hash

    Creates an associative array. E.g.

    hash(name,'Ola Norman',age,26)

     

     

    Some types can only be created from the PHP side or with the use of operators. Arrays are created with the array or the hash operator and booleans with the true and false operators.

    {* Creating array with numerics *}
    
    {array(1,2,5)}
    
     
    
    {* Creating array with strings *}
    
    {array('red','green','blue')}
    
     
    
    {* Creating associative array *}
    
    {hash(name,'Ola Norman',age,26)}
    
     
    
    {* Creating booleans *}
    
    {true()}
    
    {false()}
    
     
    
    {* Creating array with booleans *}
    
    {array(true(),false(),true())}

    Comments

    Contents

    Development

    Extensions
    Exponential datamodel
    Exponential tuning and stability
    Importing attribute data
    Kernel
    Libraries
        eZ xml
        eZ db
        eZ i18n
        eZ soap
        eZ template
           Basics
           Functions
           Operators
              Data fetch
              String handling
              Type handling
              Logical handling
              Arithmetics
              Control structure handling
              Array handling
              Image handling
              Miscellaneous
        eZ webdav
    Scripting
    Standards
    System overview
    Test Suite
    Using Doxygen to create API documenta...


    Created

    07/07/2003
    3:35:59 pm
    by Bård Farstad

    Last updated

    11/07/2003
    2:48:43 pm
    by Jan Borsodi

    Authors

    Bård Farstad
    Jan Borsodi



    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.