my out put is :
Array
(
[0] => Array
(
[num] => 338975270
)
[1] => Array
(
[num] => 4542682328
)
)
now i want to implode this array to get output like :
(338975270,4542682328)
Thanks,
siva
my out put is :
Array
(
[0] => Array
(
[num] => 338975270
)
[1] => Array
(
[num] => 4542682328
)
)
now i want to implode this array to get output like :
(338975270,4542682328)
Thanks,
siva
<?php
$out = '('.$array[0]['num'].','.$array[1]['num'].')';
echo $out;
Is that what you mean?
got this function from the user comments in the php manual. maybe this is what you’re after?:
function array_values_recursive($ary){
$lst = array();
foreach( array_keys($ary) as $k ){
$v = $ary[$k];
if (is_scalar($v)) {
$lst[] = $v;
} elseif (is_array($v)) {
$lst = array_merge( $lst,
array_values_recursive($v)
);
}
}
return $lst;
}
$a = array(array('num'=>338975270),array('num'=>4542682328));
echo '<textarea cols="100" rows="50">';
print_r(array_values_recursive($a));
echo '</textarea>';
outputs
Array
(
[0] => 338975270
[1] => 4542682328
)
or
echo implode(array_values_recursive($a),‘,’);
which outputs
338975270,4542682328