コード例 #1
0
<?php

class Circle
{
    const pi = 3.14;
    public function Area($radius)
    {
        return self::pi * ($radius * $radius);
    }
}
$get = new Circle();
echo $get->Area(5);
コード例 #2
0
<?php

class Circle
{
    const pi = 3.14159;
    public function Area($radius)
    {
        return self::pi * $radius ** 2;
    }
}
//echo Circle::pi;
$circle = new Circle();
echo $circle->Area(100);