Jump to content

copya part of a string


purencool

Recommended Posts

hi php freaks,

 

have link in a menu that looks like the following. I have been able search the string using

strpos($lines[$i],'title='). What I want to know is how do I get the  school summary into

a variable.

 

<li><a href="../index.php" title="school  summary">Summary</a></li>

 

any help would be great

 

 

Link to comment
https://forums.phpfreaks.com/topic/219147-copya-part-of-a-string/
Share on other sites

You'd probably need to use regular expressions, to make it easier.

 

Try something like this:

$string = '<li><a href="../index.php" title="school  summary">Summary</a></li>';

preg_match('/title="(.*?)"/', $string, $matches);
$title = $matches[1];

echo $title;

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.