[][src]Macro solder::php_parse_parameters

macro_rules! php_parse_parameters {
    ($p1:expr) => { ... };
    ($p1:expr, $($rest:expr), *) => { ... };
}

This macro parses all parameters passed to function. Currently, there is a limit of 5 parameters. If you try to get more parameters than what were passed to the function, PHP will emit a Warning and the excess zvals will be undefined.

use solder::zend::{ExecuteData, Zval, FromPhpZval};
#[no_mangle]
pub extern fn hello_world(_data: &ExecuteData, retval: &mut Zval) {
    let mut name_zval = Zval::new_as_null();
    php_parse_parameters!(&mut name_zval);
    let name = String::try_from(name_zval).ok().unwrap();
    let hello = format!("Hello {}", name);
    php_return!(retval, hello);
}