I have a MySQL field called “tags” an example result. The single field has a list of text with comma separated values.
A real example:
red, pants, shoes, heels, lookbook
I want to somehow use find and replace or implode feature to print out this row as separate links.
My guess so far:
<?php
$tag=$row["tags"];
whilst (!$tag=="") {
echo '<a href="/tags/$tag">$tag</a>, "';
}
?>
explode()foreachimplode()example:
Another approach would be using
preg_replace: