Micheal Micheal - 4 months ago 7
PHP Question

Php Explode string and out put each string without showing array

I have something saved in my database like this


More can stile show or it might end up being 2 or 1 depending on how may saved for current viewing post.

Now i need to Output each string separately see below example

echo $str1; Output = PHP,

echo $str2; Output = HTML,

echo $str3; Output = CSS,

echo $str4; Output = JQUERY,

I tried using this but i don't understand what is showing me please i need help with it

Here is my code

$str = 'one,two,three,four';




And the out put is this, is not what i want

Array ( [0] => one,two,three,four )
Array ( [0] => one [1] => two,three,four )
Array ( [0] => one [1] => two [2] => three )


Use array!

$str = 'one,two,three,four';

$array= explode(',',$str);

//Print each array element 
//('one' 'two' 'three' 'four' an so on...)
foreach($array as $element){
    echo $element;