php8.5
Home/ Manual/ xmlrpc / functions/ xmlrpc_set_type

xmlrpc_set_type

PHP function Edit on GitHub ✎

(PHP 4 >= 4.1.0, PHP 5, PHP 7)

Sets xmlrpc type, base64 or datetime, for a PHP string value

Description

xmlrpc_set_type(string $value, string $type): bool

Sets xmlrpc type, base64 or datetime, for a PHP string value.

Func

Parameters

value

Value to set the type

type

'base64' or 'datetime'

Return Values

Success If successful, value is converted to an object.

Errors/Exceptions

Issues E_WARNING with type unsupported by XMLRPC.

Examples

A xmlrpc_set_type() example

php
<?php

$params = date("Ymd\TH:i:s", time());
xmlrpc_set_type($params, 'datetime');
echo xmlrpc_encode($params);

?>

The above example will output something similar to:

output
<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
 <value>
  <dateTime.iso8601>20090322T23:43:03</dateTime.iso8601>
 </value>
</param>
</params>

Source: reference/xmlrpc/functions/xmlrpc-set-type.xml · from the official PHP manual (php/doc-en)