how can i convert this array to string?
public static function generos($string) {
return preg_replace(array("/(natacao)/"),explode(" ","Natação"), $string);
}
public function categoria($string) {
$this->exp = explode(",", $string);
foreach ($this->exp as $this->list) :
return $this->generos(implode(",", $this->list));
endforeach;
}
echo '<li>'.$this->categoria($rows[] = $this->row['categoria']).'</li>';
table
id | categoria
1 | futebol, voleiball
Current results
<li>futebol, voleiball</li>
expected result
<li>futebol</li>
<li>voleiball</li>
implode("</li>\n<li>", $this->list)<li>and</li>coming from? I don't see it anywhere in the code.returnstatement is ending theforeachloop during the first iteration. I don't see how you're getting bothfutebolandvoleiballin the output.