1. Go to this page and download the library: Download ffi/preprocessor 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/ */
use FFI\Preprocessor\Preprocessor;
use FFI\Preprocessor\Directive\ObjectLikeDirective;
$pre = new Preprocessor();
// #define A
$pre->define('A');
// #define B 42
$pre->define('B', '42');
// #define С 42
$pre->define('С', new ObjectLikeDirective('42'));
use FFI\Preprocessor\Preprocessor;
use FFI\Preprocessor\Directive\FunctionLikeDirective;
$pre = new Preprocessor();
// #define C(object) object##_T* object;
$pre->define('C', function (string $arg) {
return "${arg}_T* ${arg};";
});
// #define D(object) object##_T* object;
$pre->define('D', new FunctionLikeDirective(['object'], 'object##_T* object'));
use FFI\Preprocessor\Preprocessor;
$pre = new Preprocessor();
$pre->
use FFI\Preprocessor\Preprocessor;
$logger = new Psr3LoggerImplementation();
$pre = new Preprocessor($logger);
$pre->process('
#error Error message
// Will be sent to the logger:
// - LoggerInterface::error("Error message")
#warning Warning message
// Will be sent to the logger:
// - LoggerInterface::warning("Warning message")
');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.