Bitrix Site Manager

oBXEditorUtils.PHPParser.parseParameters

array
oBXEditorUtils.PHPParser.parseParameters(
 string sCode
);

The oBXEditorUtils.PHPParser.parseParameters method takes comma-separated parameters and returns an array of these parameters. The method can processes correctly process both nested and associated array declarations passed in the parameter string.

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

Parameters:

Parameter Description
sCode The string in the following format:
param1[,param2[,...,paramN]]

Return Values

Return an array.

Example


<script>

var sCode = '2,"Y",Array(1,2,"string1"),Array("name"=>"SomeName","id"=>$phpVar)';

	   
arParams = oBXEditorUtils.PHPParser.parseParameters(sCode);
//arParams[0] = 2;
//arParams[1] = "Y";
//arParams[2][0] = 1;
//arParams[2][1] = 2;
//arParams[2][2] = "string";
//arParams[3]["name"] = "SomeName";
//arParams[3]["id"] = "$phpVar";

</script>
See also getParams, parseParameters, parseFunction.