Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
initial commit
  • Loading branch information
Timothy Morris committed Feb 27, 2017
0 parents commit 4d70b61
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -0,0 +1 @@
class.element.php
10 changes: 10 additions & 0 deletions 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/)
19 changes: 19 additions & 0 deletions output.php
@@ -0,0 +1,19 @@
<?php

require('class.element.php');

/**
* Build our link
*/
$link = new Element('a', 'Click here!', array('href'=>'http://yahoo.com'));
$link->setAttribute('target', "_blank");

/**
* Build our paragraph
*/
$paragraph = new Element('p', "Interested in Yahoo? $link");

/**
* Output the HTML
*/
echo $paragraph;

0 comments on commit 4d70b61

Please sign in to comment.