-1
I have a code to cut the words after the comma. But how do I know how many string will be generated by the cutter ? For one can put 5 words, as one can put 10 at once.
$str = "valor1,valor2,valor3";
$corta = explode(",", $str);
echo $corta[0];
echo $corta[1];
For that you should use one
loop
which will print the result N times according to the size of your array– user94991
You can use the
count
to know how many elements there are in the array, that is, how many words:count($corta)
– Ricardo Pontual