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

Services_JSON::reduce_string( $str )

Parameters Parameters


(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

                // eliminate multi-line comments in '/* ... */' form, at start of string

                // eliminate multi-line comments in '/* ... */' form, at end of string

            ), '', $str);

        // eliminate extraneous space
        return trim($str);


Changelog Changelog

Version Description
5.3.0 Introduced.


Leave a Reply