Bitrix Site Manager

oBXEditorUtils.PHPParser.getArray

array
oBXEditorUtils.PHPParser.getArray(
 string sCode
);

Takes a piece of PHP code in the format "Array([parameters])" and returns an array of parameters passed in the string. The method can correctly process both nested and associated arrays maintaining their structure.

getArray can be used to simplify the PHP code parsing when creating a PHP parser.

Parameters:

Parameter Description
sCode The string in the following format:
Array([parameters])

Return Values

Return an array whose structure depends on the input.

Example


<script>

var sCode = 'array("LID"=>"en","TEXT"=>"text text text","PAYED"=>"N","CANCELED"=>"N")';
	   
arParams = oBXEditorUtils.PHPParser.getArray(sCode); 
//arParams["LID"] = "en";
//arParams["TEXT"] = "text text text";
//arParams["PAYED"] = "N";
//arParams["CANCELED"] ="N";

</script>