Пример #1
0
phpinfo();
$w = stream_get_wrappers();
echo 'openssl: ', extension_loaded('openssl') ? 'yes' : 'no', "\n";
echo 'http wrapper: ', in_array('http', $w) ? 'yes' : 'no', "\n";
echo 'https wrapper: ', in_array('https', $w) ? 'yes' : 'no', "\n";
echo 'wrappers: ', var_dump($w);
?>

<html> <head> <title>Test for ImageMagick</title> </head>
<body> <?php 
function alist($array)
{
    //This function prints a text array as an html list.
    $alist = "<ul>";
    for ($i = 0; $i < sizeof($array); $i++) {
        $alist .= "<li>{$array[$i]}";
    }
    $alist .= "</ul>";
    return $alist;
}
exec("convert -version", $out, $rcode);
//Try to get ImageMagick "convert" program version number.
echo "Version return code is {$rcode} <br>";
//Print the return code: 0 if OK, nonzero if error.
echo alist($out);
//Print the output of "convert -version"
//Additional code discussed below goes here.
?>
 </body> </html>
Пример #2
0
 public function testMapOverList()
 {
     $isOdd = function ($x) {
         return $x % 2 !== 0;
     };
     $this->assertEquals(alist(true, false, true), map($isOdd, alist(1, 2, 3)));
 }
Пример #3
0
function groundAppendo2()
{
    return appendo2(alist('a'), alist('b'), alist('a', 'b'));
}