macro_calls/
macro_calls.rs

1use whynot::{new_runtime, RuntimeConfig, RuntimeKind, PhpValue};
2use whynot::{php_call, php_eval, php_include};
3
4fn main() {
5    let cfg = RuntimeConfig { debug: false, ..Default::default() };
6    let mut rt = new_runtime(RuntimeKind::Process(cfg)).unwrap();
7
8    let r1 = php_call!(rt, hello()).unwrap();
9    println!("hello: output={:?} result={:?}", r1.output, r1.result);
10
11    let r2 = php_call!(rt, greet("Milton")).unwrap();
12    println!("greet: output={:?} result={:?}", r2.output, r2.result);
13
14    let r3 = php_eval!(rt, "print('eval works'); return 42;").unwrap();
15    println!("eval: output={:?} result={:?}", r3.output, r3.result);
16
17    let _ = php_include!(rt, "php/bootstrap.php").unwrap();
18}