diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 41a9caa..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -class.element.php diff --git a/class.element.php b/class.element.php new file mode 100644 index 0000000..5f4c70c --- /dev/null +++ b/class.element.php @@ -0,0 +1,29 @@ +tag = $t; + $this->content = $c; + $this->attrs = $a; + } + + public function setAttribute($name, $value) { + $this->attrs[$name] = $value; + } + + public function __toString() { + + $attr_string = ''; + foreach($this->attrs as $name => $value) { + $attr_string .= "{$name}='{$value}' "; + } + + return "<$this->tag $attr_string>$this->contenttag>"; + } + +} \ No newline at end of file