\rex_type

Class for var casting.

Summary

Methods
Properties
Constants
cast()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

cast()

cast(mixed  $var, mixed  $vartype) : mixed

Casts the variable $var to $vartype.

Possible types:

  • 'bool' (or 'boolean')
  • 'int' (or 'integer')
  • 'double'
  • 'string'
  • 'float'
  • 'real'
  • 'object'
  • 'array'
  • 'array[]', e.g. 'array[int]'
  • '' (don't cast)
  • a callable
  • array( array(, , ), array(, , ), ... )

Parameters

mixed $var

Variable to cast

mixed $vartype

Variable type

Throws

\InvalidArgumentException

Returns

mixed —

Castet value