diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..41a9caa --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +class.element.php diff --git a/README.md b/README.md new file mode 100644 index 0000000..43510ae --- /dev/null +++ b/README.md @@ -0,0 +1,10 @@ +# Missing Class + +One of your colleagues just committed this super-important file named `output.php` before heading off for vacation. But it looks like they forgot to include the required class, `class.element.php`. It's almost time to release this masterpiece, so you're going to have to write a new one from scratch. + +Use the contents of `output.php` to reverse engineer the missing class, it's attributes and methods. You'll need one of our favorite magic methods, [__toString()](http://php.net/manual/en/language.oop5.magic.php#object.tostring). + +When complete, `output.php` should render the following paragraph in your browser: + + +>Interested in Yahoo? [Click here!](http://yahoo.com/) diff --git a/output.php b/output.php new file mode 100644 index 0000000..875da37 --- /dev/null +++ b/output.php @@ -0,0 +1,19 @@ +'http://yahoo.com')); +$link->setAttribute('target', "_blank"); + +/** + * Build our paragraph + */ +$paragraph = new Element('p', "Interested in Yahoo? $link"); + +/** + * Output the HTML + */ +echo $paragraph;