1083. Class

1083.1. Zend\Json\Expr

Class for Zend_Json encode method.

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

Example: <code> $foo = array(

‘integer’ =>9, ‘string’ =>’test string’, ‘function’ => Zend_Json_Expr(

‘function() { window.alert(“javascript function encoded by Zend_Json”) }’

),

);

Zend_Json::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”)}} </code>

1083.1.1. Methods

1083.1.1.1. __construct

__construct()

Constructor

Parameters:string – the expression to hold.

1083.1.1.2. __toString

__toString()

Cast to string

Return type:string holded javascript expression.

Project Versions

Table Of Contents

Previous topic

1082. Class

Next topic

1084. Class

This Page