-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f1c9c2d
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class.element.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?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; |