[Solved] syntax error unexpect something [closed]


Try this:

<?php
$i=0;
foreach($model->authors as $key=>$author) { 
    if(++$i<count($model->authors)) {
        echo '<a href="http://192.168.171.46:9090/search/index?keyword='.$author->name.'">'.$author->name.';</a>';
    } else {
        echo '<a href="http://192.168.171.46:9090/search/index?keyword='.$author->name.'">'.$author->name.' </a>';
    }
}

Or if you don’t mind a slight change use this because it is a little simpler:

<?php
$ret="";
foreach($model->authors as $key=>$author) 
   $ret.=($ret?'; ':'').'<a href="http://192.168.171.46:9090/search/index?keyword='.$author->name.'">'.$author->name.'</a>';
echo $ret;

solved syntax error unexpect something [closed]