function Services_JSON::reduce_string in Album Photos 6.2
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 php/
json-php4.php - decodes a JSON string into appropriate variable
File
- php/
json-php4.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);
}