générer cercle SVG à partir de mon code php
Bonjour,
j'essaie de générer un cercle SVG en PHP.
mon problème est pour passer les variables de mon cercle au code html dans mon fichier php.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| <?php
/**
* Description of Cercle
*
*/
class Cercle {
private $r;
private $p = [];
function __construct($r, $x, $y) {
$this->r = $r;
$this->p = new Point($x, xy);
}
function getR() {
return $this->r;
}
function setR($r) {
$this->r = $r;
}
function getP() {
return $this->p;
}
function setP($p) {
$this->p = $p;
}
function circonference($r) {
$circonference = 2 * pi() * $r;
return $circonference;
}
function aire($r) {
$aire = ($r * $r) * pi();
return $aire;
;
}
function afficher() {
echo '<svg xmlns = "http://www.w3.org/2000/svg" viewBox = "0 0 200 200" width = "200" height = "200"><circle cx = '$this->p->getX()' cy = '$this->p->getY()' r = '$this->r' fill = "red" /></svg>';
}
} |
Sûrement une erreur de syntax, mais je ne vois pas.