I want to construct hyerlinks and append them as shown below .But I get error like this:
Parse error: syntax error, unexpected end of file in
could any one help me fix this error and append the hyperlinks inside for each loop correctly? Thanks in advance.
php variable to construct but give me error:
<?
$resultCounter =0;
$links ="";
$stringToSearch ="Mango";
$returnvalues=mysearch($stringToSearch);
echo $returnvalues[0];
echo $returnvalues[1];
function mysearch($stringToSearch)
{
///rest of the code
foreach ($pieces as $lineNumber => $grouped)
{
if (strpos($grouped[0], $stringToSearch) !== false)
{
$resultCounter++;
echo "<br>first line:".$grouped[0]."<br>second line:".$grouped[1]."<br>";
$stream_name = substr($grouped[0],strrpos($grouped[0],',')+1);
$stream_url = $grouped[1];
$stream_logo = scrape_value($grouped[0], 'tvg-logo');
$parsed = get_string_between($stream_logo, '_', '_');
$links .="<li><a id=\"CH"\".$parsed."\" onclick=\"setMe(false);setCurrentID('".$parsed."');javascript:doit('".$stream_url."','".$stream_logo."',this.id);\">'".$stream_name."'</a><img src=\"".$stream_logo."\" /></li>\n\n";
}//end of if
}// end of for each
return array($links,$resultCounter);
}//end of function
?>
<?php echo $links; ?>
sample:
<li><a id="CH123456" onclick="setMe(false);setCurrentID('123456');javascript:doit('html://somesite.com/','./logos/123456.png',this.id);">test</a><img src="./logos/123456.png"></li>
答案 0 :(得分:0)
我把return数组($ links,$ resultCounter);在每个循环结束后,我的数据正确返回!