Documentation

cleanCode

string
oBXEditorUtils.PHPParser.cleanCode(
 string sCode
);

The 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.

Returned 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>
© «Bitrix24», 2001-2024