Page 1 of 1

Javascript - getElementByType ... PHP got any same function?

Posted: Sun Feb 11, 2007 1:30 am
by phlai
Hi guys,

If I have a list of words like..

Code: Select all

<font>Hey This</font><br/>
<div>No no..</div>
<a href="test.php">adasd</a>
Is there a way to extract the link test.php out from the contents in php?

Posted: Sun Feb 11, 2007 1:38 am
by james.aimonetti
The dark art of regular expressions could be your friend. http://php.net/pcre describes native PHP solutions. There are also plenty of tutorials that help with creating an appropriate regexp to extract data from strings.

Posted: Sun Feb 11, 2007 3:47 am
by Kieran Huggins
james.aimonetti wrote:The dark art of regular expressions...
8O I love it! :D

Another way of doing it would be to load it into SimpleXML... Check out http://php.net/manual/en/ref.simplexml.php

Posted: Sun Feb 11, 2007 4:58 am
by phlai
Oh ic! Regular Expression.. Thanks guys! I will try to find out how to use it! :)

Im a newbie to php.. keke.. hope I can be some help in here also.. :)