Jump to content

str_replace();


sepoto

Recommended Posts

I can not understand at all why my call to str_replace is returning a null string:

if($artsize > 9) {	for ($i = 0; $i < 10; $i++) {		$colpos = strpos($articles[$i][1], ":" );		$twithandle = substr($articles[$i][1], 0, $colpos);		$new = str_replace($twithandle, '<a href="">Testing:</a>', $article[$i][1]);		echo "{$colpos} <br>";		echo "{$new}...<a class='feed' href='{$articles[$i][3]}' target='_new'>More ></a><br/><br/>";	}}

$twithandle clearly contains a string as does $article[$i][1]. Something is very fishy with this.

Link to comment
Share on other sites

You are right it is $articles not $article which is going to be a big problem because $article is undefined at that point and essentially contains nothing. Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...