Reputation:
Array
(
[0] => Array
(
[uid] => 43543534
)
)
I'm trying to get output as [0] => [43543534]
I tried foreach()
but I'm getting string as output
Update How do I find max value now in this?
Upvotes: -1
Views: 127
Reputation: 37701
Your question is very unclear, but here are two ways to accomplish that using the original array:
$array = array( '0' => array ( 'uid' => '43543534' ) );
$result[0] = $array[0]['uid];
or with foreach
$array = array( '0' => array ( 'uid' => '43543534' ) );
foreach($array as $a){
$result[] = $a['uid'];
}
Upvotes: 0
Reputation: 1120
$var = array( '0' => array ( 'uid' => '43543534' ) );
foreach($var as $arr):
echo $arr['uid'];
endforeach;
Upvotes: 0
Reputation: 1047
Why don't you have only 1 dimensional array array('0' => 43543534)
, if you have only 'uid' in the second one
foreach ($yourArray as $key => $val) {
echo '['.$key.'] => ['.$val['uid'].']<br />';
}
Upvotes: 2