Tests XMLRPC API by adding two numbers for client.
Parameters
$argsint[]required- Method arguments. Note: arguments must be ordered as documented.
0intA number to add.1intA second number to add.
Source
public function addTwoNumbers( $args ) {
if ( ! is_array( $args ) || count( $args ) !== 2 || ! is_int( $args[0] ) || ! is_int( $args[1] ) ) {
$this->error = new IXR_Error( 400, __( 'Invalid arguments passed to this XML-RPC method. Requires two integers.' ) );
return $this->error;
}
$number1 = $args[0];
$number2 = $args[1];
return $number1 + $number2;
}
Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.