I am working with php and phpexcel,I have following array($data) i want to search and append array value in php,For example i want to change "link" value(want to add "txt" with previous value) of user whose email id is "[email protected]",But its not working properly, i mean after refresh page , its removing previous "appended" value and append current value,but i want keep previous value also,Ho can i do this ? Here is my current array
Array
(
[0] => Array
(
[email] => [email protected]
[link] => abc,xyz,def
)
[1] => Array
(
[email] => [email protected]
[link] => cde,abb
)
...
Expected result (adding "bbb" instead of removing "abb")
Array
(
[0] => Array
(
[email] => [email protected]
[link] => abc,xyz,def
)
[1] => Array
(
[email] => [email protected]
[link] => cde,abb,bbb
)
...
I tried with following code but "removing" previous value ("abb"),i want to append new value with previous
$searchEmail = '[email protected]';
$appendString = 'bbb';
foreach ($set_excel_query_all as $key => &$item) {
if ($item['email'] == $searchEmail) {
$item['link'] .= ',' . $appendString;
break;
}
}
unset($item);