2015-05-25 101 views
0
foreach ($hash as $h) { 
    array_push($users, $h['entities']['urls'][0]['expanded_url']); 
} 

我也想推$h['created_at']$users所以它會是這個樣子:推多個元素在一個關鍵

Array 
(
    [0] => Array 
     (
      [0] => 'http://www.google.com' 
      [1] => 'Sun May 17 06:32:14 +0000 2015' 

     ) 
) 

有沒有辦法我能做到這一點?

回答

0

如果我理解正確的,你想數組

foreach ($hash as $h) 
     $users[] = array($h['entities']['urls'][0]['expanded_url'], $h['created_at']); 
+0

是感謝你的陣列! – rwar

+0

很高興爲您服務! – splash58

0

最簡單的方法是這樣的:

$user[] = $h['created_at'];