I am trying to create a string out of a array variable. Here is an example:
$var = array(0=> '', 1 => 'a', 2 => 'b', 3 => 'c', 4 => 'd');
$string = '';
foreach($var as $key=>$value)
{
$string.= $value . '/';
}
echo 'www.mysite.com/' . $string;
And it comes out like this:
www.mysite.com//a/b/c/d/
And if I change $var to = array(0 => '');
It comes out like:
www.mysite.com//
How can I get the formatting right it shows up like:
www.mysite.com/a/b/c/d/