Thursday, 31 December 2015

how to separate words after the commas in the variable to make links

Here is example what I want to make

$text = "admin,demo"; //whit foreach in php
to
 href="/admin" title="admin">admin href="/demo" title="demo">demo

$text = 'admin,demo';
$list = explode(',', $text);

foreach ($list as $link) {
    echo '.$link.'" title="'.$link.'">'.$link.'
'; }

No comments:

Post a Comment

Hit me with a comment!