Bitrix Site Manager

oBXEditorUtils.PHPParser.trimPHPTags

string
oBXEditorUtils.PHPParser.trimPHPTags(
 string sCode
);

The oBXEditorUtils.PHPParser.trimPHPTags method strips <?php ?> or <? ?> off the PHP tags passed as the parameter. If the input does not contain PHP tags, the original string is returned.

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

Parameters:

Parameter Description
sCode The string which is a PHP code fragment.

Return Values

Returns the string.

Example


<script>

var sCode = '<?php MyPHPFunction(); ?>';

sCode = oBXEditorUtils.PHPParser.trimPHPTags(sCode);//sCode = ' MyPHPFunction(); ';

</script>
See also trimQuotes.