
Untitled
By: a guest on
Aug 9th, 2012 | syntax:
None | size: 0.54 KB | hits: 7 | expires: Never
how to separate array with commas?
<?php
if ( is_array($_categories) ) {
foreach ($_categories as $key => $value) {
$out = array();
array_push($out, $value);
echo implode(', ', $out);
}
}
else {
echo '<li>There are no saved values yet.</li>';
}
?>
echo implode(', ', $_categories);
$out = array(); //putting outside of the loop
foreach ($_categories as $key => $value) {
array_push($out, $value);
}
echo implode(', ', $out); //putting outside of the loop