2 defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w'));
3 function skipif($if, $skip) { if ($if) { fprintf(STDOUT, "skip $skip"); exit(); }}
4 function checkcgi() { skipif(!strncasecmp('CLI', PHP_SAPI, 3), 'need CGI SAPI'); }
5 function checkext($ext) { skipif(!extension_loaded($ext), "need ext/$ext"); }
6 function checkver($ver) { skipif($ver > (int) PHP_VERSION, "need PHP v$ver"); }
7 function checkurl($url) { skipif(!@fsockopen($url, 80), "$url not responsive"); }