array to string conversion in php database code example
Example 1: Array to String Conversion in PHP
$gadget = array( 'computer', 'mobile', 'tablet' );
echo implode($arr);
Example 2: Notice: Array to string conversion php
$stuff = array(1,2,3);
print json_encode($stuff);
Example 3: array to string conversion in php
function subArraysToString($ar, $sep = ', ') {
$str = '';
foreach ($ar as $val) {
$str .= implode($sep, $val);
$str .= $sep;
}
$str = rtrim($str, $sep);
return $str;
}
echo subArraysToString($food);