hi friends I have a php array for eg.
$mob_numbers= array(12345674, 12345675, 12345676,12345677);
I want to eacho out all of them at once so that it appears
12345674,12345675,12345676,12345677
(with comma) .
How do i do it ? I tried array explode, didn't work. Pls help
To echo an array, use the format echo ${Array[0]}. Array is your array name, and 0 is the index or the key if you are echoing an associative array. You can also use @ or * symbols instead of an index to print the entire array.
Just use implode
function as:
echo implode(',',$mob_numbers);
explode
is used to split a string
to get an array
implode
does the opposite of joining the array
elements to get a string
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With