You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PHP functions and methods are represented by the `Function` struct.
4
+
5
+
You can use the `try_from_function` and `try_from_method` methods to obtain a Function struct corresponding to the passed function or static method name.
6
+
It's heavily recommended you reuse returned `Function` objects, to avoid the overhead of looking up the function/method name.
7
+
8
+
You may also use the infallible `from_function` and `from_method` variants, for example when working with native PHP functions/classes that are guaranteed to be always available.
9
+
10
+
```rust,no_run
11
+
# #![cfg_attr(windows, feature(abi_vectorcall))]
12
+
# extern crate ext_php_rs;
13
+
use ext_php_rs::prelude::*;
14
+
15
+
use ext_php_rs::zend::Function;
16
+
17
+
#[php_function]
18
+
pub fn test_function() -> () {
19
+
let substr = Function::from_function("var_dump");
20
+
let _ = substr.try_call(vec!["abc"]);
21
+
}
22
+
23
+
#[php_function]
24
+
pub fn test_method() -> () {
25
+
let f = Function::from_method("ClassName", "staticMethod");
0 commit comments