I am unable to get as to why I am unable to change the value of an array of an array. Here's the code I tried
print_r($target_file);
foreach ($target_file as $k => $v) {
unset ($v['tmp_name']);
print_r($v);
$v['tmp_name'] = "joker";
print_r($v);
}
print_r($target_file);
And output I get is:
(
[0] => Array
(
[name] => order-confirmation-60dc3f6f8d7f3.pdf
[type] => application/pdf
[tmp_name] => C:\Users\kbged\Desktop\XAMPP\tmp\php2FDB.tmp
[error] => 0
[size] => 367185
)
)
Array
(
[name] => order-confirmation-60dc3f6f8d7f3.pdf
[type] => application/pdf
[error] => 0
[size] => 367185
)
Array
(
[name] => order-confirmation-60dc3f6f8d7f3.pdf
[type] => application/pdf
[error] => 0
[size] => 367185
[tmp_name] => joker
)
Array
(
[0] => Array
(
[name] => order-confirmation-60dc3f6f8d7f3.pdf
[type] => application/pdf
[tmp_name] => C:\Users\kbged\Desktop\XAMPP\tmp\php2FDB.tmp
[error] => 0
[size] => 367185
)
)
Any ideas as to why I am unable to update the array value outside the scope of this for loop?
Thanks!