Zend Framework  2.4
Public Member Functions | Protected Attributes | List of all members
Expr Class Reference

Class for Zend encode method. More...

Public Member Functions

 __construct ($expression)
 Constructor.
 
 __toString ()
 Cast to string.
 

Protected Attributes

 $expression
 

Detailed Description

Class for Zend encode method.

This class simply holds a string with a native Javascript Expression, so objects | arrays to be encoded with Zend can contain native Javascript Expressions.

Example: $foo = array( 'integer' => 9, 'string' => 'test string', 'function' => Zend( 'function () { window.alert("javascript function encoded by Zend\Json\Json") }' ), );

Zend::encode($foo, false, array('enableJsonExprFinder' => true)); // it will returns json encoded string: // {"integer":9,"string":"test string","function":function () {window.alert("javascript function encoded by Zend\Json\Json")}}

Constructor & Destructor Documentation

__construct (   $expression)

Constructor.

Parameters
string$expressionthe expression to hold.

Member Function Documentation

__toString ( )

Cast to string.

Returns
string holded javascript expression.

Member Data Documentation

$expression
protected