Services_JSON::encode

Advertisement

Deprecated Deprecated

This method has been deprecated. Use the PHP native JSON extension instead.

Summery Summery

encodes an arbitrary variable into JSON format (and sends JSON Header)

Syntax Syntax

Services_JSON::encode( mixed $var )

Parameters Parameters

$var

(Required) any number, boolean, string, array, or object to be encoded. see argument 1 to Services_JSON() above for array-parsing behavior. if var is a string, note that encode() always expects it to be in ASCII or UTF-8 format!

Return Return

(mixed) JSON string representation of input var or an error if a problem occurs

Source Source

File: wp-includes/class-json.php

    function encode($var)
    {
        _deprecated_function( __METHOD__, '5.3.0', 'The PHP native JSON extension' );

        header('Content-type: application/json');
        return $this->encodeUnsafe($var);
    }

Advertisement

Changelog Changelog

Changelog
Version Description
5.3.0 Introduced.

Advertisement

Leave a Reply