function Services_JSON::reduce_string in Video 7
reduce a string by removing leading and trailing comments and whitespace
@access private
Parameters
$str string string value to strip of comments and whitespace:
Return value
string string value stripped of comments and whitespace
1 call to Services_JSON::reduce_string()
- Services_JSON::decode in modules/
video_zencoder/ includes/ lib/ JSON.php - decodes a JSON string into appropriate variable
File
- modules/
video_zencoder/ includes/ lib/ JSON.php, line 452
Class
- Services_JSON
- Converts to and from JSON format.
Code
function reduce_string($str) {
$str = preg_replace(array(
// eliminate single line comments in '// ...' form
'#^\\s*//(.+)$#m',
// eliminate multi-line comments in '/* ... */' form, at start of string
'#^\\s*/\\*(.+)\\*/#Us',
// eliminate multi-line comments in '/* ... */' form, at end of string
'#/\\*(.+)\\*/\\s*$#Us',
), '', $str);
// eliminate extraneous space
return trim($str);
}