Deprecated Deprecated
This method has been deprecated. Use the PHP native JSON extension instead.
Private Access Private Access
This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Summery Summery
reduce a string by removing leading and trailing comments and whitespace
Syntax Syntax
Parameters Parameters
- $str
-
(Required) string string value to strip of comments and whitespace
Return Return
(string) string value stripped of comments and whitespace
Source Source
File: wp-includes/class-json.php
function reduce_string($str) { _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' ); $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); }
Advertisement
Changelog Changelog
Version | Description |
---|---|
5.3.0 | Introduced. |