WordPress at a glance
function is not described

Services_JSON::reduce_string() public WP 1.0

Deprecated in from version 5.3.0. It is no longer supported and can be removed in future releases. Use PHP native JSON extension instead.

reduce a string by removing leading and trailing comments and whitespace

{} It's a method of the class: Services_JSON{}

No Hooks.

Return

String. string value stripped of comments and whitespace

Usage

$Services_JSON = new Services_JSON();
$Services_JSON->reduce_string( $str );
string($str) (required)
string value to strip of comments and whitespace

Changelog

Deprecated Since 5.3.0 Use the PHP native JSON extension instead.

Code of Services_JSON::reduce_string() WP 5.5.1

<?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);
}