PHP code example of try / predict-output
1. Go to this page and download the library: Download try/predict-output 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/ */
try / predict-output example snippets
TryPhp\PredictOutputTrait;
$assertions = new class() {
use PredictOutputTrait();
}
$assertions->predictOutput(function () {
echo '\e[33msomething\n';
}, 'something'); // won't throw an exception
$assertions->predictOutput(function () {
echo '\e[33msomething\n';
}, 'something other'); // will throw an exception