sepoto Posted July 21, 2011 Share Posted July 21, 2011 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 More sharing options...
Ingolme Posted July 21, 2011 Share Posted July 21, 2011 Print out the values before and after each line to see what's happening to them. Link to comment Share on other sites More sharing options...
justsomeguy Posted July 21, 2011 Share Posted July 21, 2011 Is your variable $article or $articles? Link to comment Share on other sites More sharing options...
sepoto Posted July 21, 2011 Author Share Posted July 21, 2011 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.