1. Go to this page and download the library: Download danfekete/spec 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/ */
/*
* You can use classes in expression code
*/
class Nan {
public function isNan($value)
{
return is_nan($value);
}
}
$spec = new Specification(new AndSpec(
new NotSpec(new ExpressionSpec('checker.isNan(d)')),
new OrSpec(
new ExpressionSpec('d != 12'),
new ExpressionSpec('d > 10')
),
new AndSpec(
new ExpressionSpec('d > 5'),
new ExpressionSpec('d < 20')
)
));
$spec->isSatisfiedBy(['d' => 17, 'checker' => new Nan()]); // return true
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.