Skip to content

Instantly share code, notes, and snippets.

@lol97
Last active February 23, 2019 16:46
Show Gist options
  • Select an option

  • Save lol97/abf3a87031f8277d249c5fdf24e44f45 to your computer and use it in GitHub Desktop.

Select an option

Save lol97/abf3a87031f8277d249c5fdf24e44f45 to your computer and use it in GitHub Desktop.
Ask PHP 7,Array
<?php
$data = [
0 => [
'nama_file' = 'wajah1.png',
'id' = 'orang1',
'bit-depth' = 8,
],
1 => [
'nama_file' = 'wajah2.png',
'id' = 'orang2',
'bit-depth' = 16,
]
];
$bit_depth=[8,16];
//expected output
$data = [
'satu' => [
'nama_file' = 'wajah1.png',
'id' = 'orang1',
'bit-depth' = 8,
],
'dua' => [
'nama_file' = 'wajah2.png',
'id' = 'orang2',
'bit-depth' = 16,
]
];
?>
@lol97

lol97 commented Feb 23, 2019

Copy link
Copy Markdown
Author

psudocode
Ini asumsi length kedua arrah nya sama

for (i = 0; i < data.length; i++ ) {
data['bit-depth'] = bit-depth[i]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment