Hi, as a newbee i'm trying to figure this code out:
$search = get_the_title();
$lines = file('links.txt');
// Store true when the text is found
$found = false;
foreach($lines as $line)
{
if(strpos($line, $search) !== false)
{
$found = true;
echo $line,"<br/>";
}
}
// If the text was not found, show a message
if(!$found)
{
echo 'not found';
links.txt file contains links like:
<a href="https://blabla.com/blablabla/blablablabla/The word or file to search" target="_blank" rel="noopener noreferrer">The word or file to search</a>
I just want to search the this part: ( ">The word or file to search</a> ) of the url then return it as an clickable url and also limit search results to 3. Could somebody help me which code and where to put in php code above? Thanks in advance.