PHP code example of davidlienhard / functioncaller

1. Go to this page and download the library: Download davidlienhard/functioncaller 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/ */

    

davidlienhard / functioncaller example snippets


 declare(strict_types=1);

use DavidLienhard\FunctionCaller\Call as FunctionCaller;

$caller = new FunctionCaller("file", "testfile.txt");   // create caller instance
$result = $caller->getResult();                         // get result from call

if ($result === false) {                                // check if function has return false
    $errstr = $caller->getLastError()?->getErrstr();    // get error string
    $errno = $caller->getLastError()?->getErrno();      // get error number

    throw new \Exception("unable to read file 'testfile.php': ".$errstr." (".$errno.")");
}