ext-hello · PHP API
PHP API
The whole PHP surface of ext-hello: one function that returns a fixed string. No arguments, no state, no side effects.
The extension registers under the module name hello and adds a single global function.
bm_hello
bm_hello(): string
Public method. Returns string.
Returns the string "hello from ext-hello package". It takes no arguments; passing any throws an
ArgumentCountError.
<?php
var_dump(bm_hello()); // string(28) "hello from ext-hello package"
Checking it is there
A firmware built without the package has no bm_hello(). Guard optional use with extension_loaded() or
function_exists(), so the same script runs on both:
<?php
if (extension_loaded('hello')) {
echo bm_hello(), "\n";
} else {
echo "ext-hello is not built in\n";
}
Related
- Hello extension Overview
- Check that a package is built in Recipe