Bitrix Site Manager

oBXEditorUtils.PHPParser.cleanCode

string
oBXEditorUtils.PHPParser.cleanCode(
 string sCode
);

The oBXEditorUtils.PHPParser.cleanCode method removes comments, CR and LF, excessive white space from the PHP code. Can be used to simplify parsing the PHP code fragment when creating a PHP parser.

Parameters:

Parameter Description
sCode The string containing a PHP code fragment.

Return Values

Returns a string.

Example


<script>

var sCode = '$arFields   =   array('+
	   '"LID" => "en", //language'+
	   '"TEXT" => "text text text", //text'+
	   '"PAYED" => "N",'+
	   '"CANCELED" => "N"'+
	   ');'
	   
sCode = oBXEditorUtils.PHPParser.cleanCode(sCode); 
//sCode = '$arFields=array("LID"=>"en","TEXT"=>"text text text","PAYED"=>"N","CANCELED"=>"N")';

</script>