Skip to content

Instantly share code, notes, and snippets.

@hanafiah
Created October 9, 2014 01:54
Show Gist options
  • Save hanafiah/a8628b0be5e9e2dcfb61 to your computer and use it in GitHub Desktop.
Save hanafiah/a8628b0be5e9e2dcfb61 to your computer and use it in GitHub Desktop.
contoh 1
<?php
$arr = [
'a' => [
0=>[
'file_name'=>'abc',
'file_type'=>'image/jpeg',
],
1=>[
'file_name'=>'def',
'file_type'=>'image/jpeg',
]
]
];
print_r($arr);
$arr=add_product_num($arr,2);
print_r($arr);
function add_product_num($array,$product_num){
foreach($array['a'] as $key=>$rows){
$rows['product_num'] = $product_num;
$array['a'][$key]=$rows;
}
return $array;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment