Services_JSON::name_value

Advertisement

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

array-walking function for use in generating JSON-formatted name-value pairs

Syntax Syntax

Services_JSON::name_value( string $name, mixed $value )

Parameters Parameters

$name

(Required) name of key to use

$value

(Required) reference to an array element to be encoded

Return Return

(string) JSON-formatted name-value pair, like '"name":value'

Source Source

File: wp-includes/class-json.php

    function name_value($name, $value)
    {
        _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );

        $encoded_value = $this->_encode($value);

        if(Services_JSON::isError($encoded_value)) {
            return $encoded_value;
        }

        return $this->_encode(strval($name)) . ':' . $encoded_value;
    }

Advertisement

Changelog Changelog

Changelog
Version Description
5.3.0 Introduced.

Advertisement

Leave a Reply