xmlrpc_get_type

(PHP 4 >= 4.1.0, PHP 5)

xmlrpc_get_typeGets xmlrpc type for a PHP value

說明

string xmlrpc_get_type ( mixed $value )
Warning

本函式是實驗性的。這個函式的行為、名稱、和關於此函式的任何其他文件在未來PHP的發行中可能會在不通知的情況下改變。 使用此函式需自行承擔風險。

This function is especially useful for base64 and datetime strings.

參數

value

PHP value

回傳值

Returns the XML-RPC type.

範例

Example #1 XML-RPC type example

<?php
echo xmlrpc_get_type(null) . "\n"// base64
echo xmlrpc_get_type(false) . "\n"// boolean
echo xmlrpc_get_type(1) . "\n"// int
echo xmlrpc_get_type(1.0) . "\n"// double
echo xmlrpc_get_type("") . "\n"// string
echo xmlrpc_get_type(array()) . "\n"// array
echo xmlrpc_get_type(new stdClass) . "\n"// array
echo xmlrpc_get_type(STDIN) . "\n"// int
?>

參見

add a note add a note

User Contributed Notes 1 note

up
0
hfuecks at pinkgoblin dot com
21 years ago
This function returns the type of a PHP variable in XML-RPC terms. It won't "spot" base64 or iso8601 types unless they have been defined using xmlrpc_set_type().

For iso8601 type it returns "datetime".

Otherwise it returns strings corresponding directly the XML-RPC data types e.g. "struct","int","string","base64" etc.
To Top