I have something saved in my database like this
PHP,HTML,CSS,SQL,JQUERY,....
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
<?php
$str = 'one,two,three,four';
print_r(explode(',',$str,0));
print_r(explode(',',$str,2));
print_r(explode(',',$str,-1));
?>
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 )
$arr = explode(',', $str)? The default forexplodeis to explode on ALL matching elements. you only specify the 3rd argument if you want LESS than than 'all'.