Page 1 of 1

Need a halp!PHP homework!

Posted: Wed Feb 03, 2010 11:05 am
by pupupusik
Plese I need that for morning for tomorrow!
Thanks!

2. You have been asked to do some textual analysis of html code programatically. Given HTML code as input please provide answers to the following:

a) Write a php function which will take as input a parameter containing random html code. Examine the code and extraxt the text from the deepest nested tag fount in the code. Example:

INPUT:
$x= '
Hello there. <p> Today it was a <b>beautiful</b> sunny day in <a href="http://israel.co.il">Tel Aviv</a> sea shore. Having come from a <span class="newtext">country which does not have a sea <span class="more"> <br />I found it very interesting to look at the <strong>waves</strong></span> smashing <b>against</b> the </span>walls of the harbour</p>
'
foo($x);

OUTPUT
waves

b) Please write a php function which will take a html code as parameter and output the nesting level of each tag in their order of appearance preceeded by the tag name. For example for input from a) the result would be:
p -> 1
b -> 2
a -> 2
span -> 2
span -> 3
br -> 3
strong -> 4
b -> 2

Re: Need a halp!PHP homework!

Posted: Wed Feb 03, 2010 11:08 am
by AbraCadaver
Do your own homework! How do you expect to learn? Haven't you been studying / paying attention in class?

Re: Need a halp!PHP homework!

Posted: Wed Feb 03, 2010 11:45 am
by pupupusik
So what!!!!!!!!!!!!!!!!!!!1
I need a halp pleeeeeeeessssssssss!

Re: Need a halp!PHP homework!

Posted: Wed Feb 03, 2010 12:32 pm
by califdon
We don't help people who just want someone to do their work for them. If you don't understand some concept, we will try to explain it to you so you can learn, but we don't help people cheat.