For some reason when an array has for example, four values it will display all four values four times I just want the values to be displayed one time.
How can I fix this problem? Note the first echo works perfectly.
Here is the code.
if (count($array) == 1){
echo $array[$x] . " one value has been entered";
} else {
echo implode(", ", $array) ." you entered more then one value;
}
Because
$xobviously isn’t the index of the first element of the array. Use the correct index. Or if you don’t know what it is, just usereset():It might be helpful to dump the array to see what it actually contains: