Logo Search packages:      
Sourcecode: dojo version File versions  Download package

Services_JSON::reduce_string ( str  ) 

reduce a string by removing leading and trailing comments and whitespace

Parameters:
$str string string value to strip of comments and whitespace
Returns:
string string value stripped of comments and whitespace private

Definition at line 443 of file json.php.

Referenced by decode().

    {
        $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);
    }


Generated by  Doxygen 1.6.0   Back to index