RE: Searching PHP strings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



eregi_replace or str_replace can do that for you

Bastien


From: "Ron Piggott (PHP)" <ron.php@xxxxxxxxxxxxxxxxxx>
Reply-To: ron.php@xxxxxxxxxxxxxxxxxx
To: PHP DB <php-db@xxxxxxxxxxxxx>
Subject:  Searching PHP strings
Date: Thu, 28 Sep 2006 21:12:18 -0400

I have been playing tonight for a few minutes.

The following code:

<?

$lineArray = file("/home/actsmin/www/home_page.html");

// make an empty variable first
$content =  "";

// concat all array element
foreach($lineArray as $eachLine) {

if ( eregi("<a href=" , $eachLine) == "1" ) {

#line contains a link

echo strlen(stristr($eachLine, "<a href=")) . "\r\n";
echo trim(stristr($eachLine, "<a href=")) . "\r\n";

}

$content .= $eachLine;
}

?>

Produces me output like:

137

<a href="http://www.actsministrieschristianevangelism.org/christianliving/quiet_time_quotations_and_reflection_topics.html";>here</a>.<p>

What I want to do now is to remove the

<a href="

and just be left with

http://www.actsministrieschristianevangelism.org/christianliving/quiet_time_quotations_and_reflection_topics.html

and remove all the text which follows this --- On this line it is

">here</a>.<p>

Would someone help me do this?

Ron

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux