Services_JSON::name_value
Deprecated since 5.3.0. It is no longer supported and may be removed in future releases. Use
PHP native JSON extension instead.array-walking function for use in generating JSON-formatted name-value pairs
Method of the class: Services_JSON{}
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
String. JSON-formatted name-value pair, like '"name":value'
Usage
$Services_JSON = new Services_JSON(); $Services_JSON->name_value( $name, $value );
- $name(string) (required)
- name of key to use.
- $value(mixed) (required)
- reference to an array element to be encoded.
Changelog
| Deprecated since 5.3.0 | Use the PHP native JSON extension instead. |
Services_JSON::name_value() Services JSON::name value code WP 7.0
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((string) $name) . ':' . $encoded_value;
}