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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
phlai
Forum Newbie
Posts: 2
Joined: Sun Feb 11, 2007 1:27 am

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

Post 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?
james.aimonetti
Forum Newbie
Posts: 6
Joined: Tue Jan 30, 2007 10:44 pm

Post 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.
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Post 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
phlai
Forum Newbie
Posts: 2
Joined: Sun Feb 11, 2007 1:27 am

Post 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.. :)
Post Reply