Demo

討論

保持飢餓,保持愚笨 (Stay hungry, stay foolish)。 史蒂夫·賈伯斯

公告

本網站已取消討論區的討論方式,如果您有問題請至LINE群行動條碼圖片網址,或Facebook社團

foreach敘述中改變key對應value值的技巧

More
2006-05-15 16:00 #2433 來自 Eddy
Eddy created the topic: foreach敘述中改變key對應value值的技巧
[Ed Note: You can also use array_keys() so that you don't have to have the $value_copy variable --alindeman at php.net]

I use the following to modify the original values of the array:
foreach ($array as $key=>$value_copy)
{
$value =& $array[$key];
// ...
$value = 'New Value';
}

知之者不如好之者,好之者不如樂之者

Please 登入 to join the conversation.