function _xmlrpc_example_server_subtract
Same name in other branches
- 7.x-1.x xmlrpc_example/xmlrpc_example.module \_xmlrpc_example_server_subtract()
Return the difference of the two arguments.
This is the callback for the xmlrpc_example.subtract xmlrpc method.
Parameters
numeric $num1:
numeric $num2:
Return value
The difference of the two arguments, or error if it is not in server defined bounds.
See also
xmlrpc_error()
Related topics
1 string reference to '_xmlrpc_example_server_subtract'
- xmlrpc_example_xmlrpc in xmlrpc_example/
xmlrpc_example.module - Implements hook_xmlrpc().
File
-
xmlrpc_example/
xmlrpc_example.module, line 193
Code
function _xmlrpc_example_server_subtract($num1, $num2) {
$diference = $num1 - $num2;
// If result is not within maximum and minimum limits, return corresponding error
if ($diference > variable_get('xmlrpc_example_server_max', 10)) {
return xmlrpc_error(10001, t("Result is over the higher limit defined by the server."));
}
if ($diference < variable_get('xmlrpc_example_server_min', 0)) {
return xmlrpc_error(10002, t("Result is under the lower limit defined by the server."));
}
// Otherwise return the result.
return $diference;
}