1. Go to this page and download the library: Download erebot/callable-wrapper library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
erebot / callable-wrapper example snippets
// Load composer's autoloader
ebot\CallableWrapper::initialize();
// Define a function/method that uses the "callable" typehint
// as you normally would, even for PHP 5.3.x.
function invokeCode(callable $code) {
$result = null;
$code($result);
return $result;
}
// Wrap some code to make it compatible with the typehint.
// In this case, we used a closure, but you may use anything
// that is callable by PHP's standards (eg. a function, a method,
// an anonymous function or an invokable object would be fine too)
$wrapped = Erebot\CallableWrapper::wrap(
function (&$retval) {
$retval = 42;
}
);
// Outputs "int(42)" because the $result from invokeCode()
// was by reference to the wrapped closure and modified there.
var_dump(invokeCode($wrapped));