<?php
class cercle 
{
    private $rayon;

    function __construct($rayon)
    {
        $this->rayon = $rayon;
    }

    function surface() 
    {
        return M_PI * $this->rayon * $this->rayon;
    }

    function rayon()
    {
        return $this->rayon;
    }

    function changer_rayon($rayon) 
    {
        if($rayon < 0)
        {
            echo " Erreur : impossible de définir un cercle de rayon négatif! ";
        }
        else 
        {
            $this->rayon = $rayon;
        }
    }
}

$cercle3 = new cercle(3);
echo $cercle3->surface();

echo " ";

$cercle5 = new cercle(5);
echo $cercle5->surface();

echo " ";

$cercleN = new cercle(2);
echo $cercleN->surface();

echo " ";

$cercleN->changer_rayon(7);
echo $cercleN->surface();

echo " ";
$cercleN->changer_rayon(-1);
echo $cercleN->rayon();