From 64983ddb609f45508c55708d3b32cfcf63c3d2fe Mon Sep 17 00:00:00 2001 From: Sofiane Lasri <alasri250@gmail.com> Date: Fri, 28 Oct 2022 00:00:52 +0200 Subject: [PATCH] Fin de TP4 ex6. --- TP4/ex1/models/Objet.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/TP4/ex1/models/Objet.php b/TP4/ex1/models/Objet.php index 193f198..28c1223 100644 --- a/TP4/ex1/models/Objet.php +++ b/TP4/ex1/models/Objet.php @@ -6,6 +6,14 @@ require_once "Objet.php"; */ class Objet { + public function __construct($data = null) + { + if(!is_null($data)){ + foreach ($data as $key => $value){ + $this->$key = $value; + } + } + } /** * @param $name * @return mixed -- GitLab