コード例 #1
0
}
function areasDif($x, $y)
{
    echo "Shapes with dimentsions of " . $x . " by " . $y . " have varying areas";
    $rec = areaRec($x, $y);
    $tri = areaTri($x, $y);
    $cir = areaCir($x);
    echo "Area of circle: " . $cir . "<br>" . "Area of rectangle: " . $rec . "<br>" . " Area of triangle: " . $tri;
}
areasDif(7, 3);
//**** Functions *****
function First()
{
    echo "Hello World";
}
First();
function Second($num1, $num2)
{
    echo $num1 . " " . $num1 . " little " . $num2;
}
Second("twinkle", "star");
function Math($x, $y)
{
    $a = $x + $y;
    $b = $x - $y;
    $c = $x / $y;
    $d = $x * $y;
    $e = $y / $x;
    $f = "<br>" . "The sum of this equals ";
    echo $f . $b;
    echo $f . $a;
コード例 #2
0
ファイル: example.php プロジェクト: straiway/fmt
function GoogleConcurrentFirst($qry)
{
    $chn = make_channel();
    cofunc(function ($chn, $qry) {
        $chn->in(First($qry, 'Web1', 'Web2', 'Web3'));
    }, $chn, $qry);
    cofunc(function ($chn, $qry) {
        $chn->in(First($qry, 'Image1', 'Image2', 'Image3'));
    }, $chn, $qry);
    cofunc(function ($chn, $qry) {
        $chn->in(First($qry, 'Video1', 'Video2', 'Video3'));
    }, $chn, $qry);
    $results = [];
    for ($i = 0; $i < 3; ++$i) {
        $results[] = $chn->out();
    }
    $chn->close();
    return $results;
}