Skip to content

Instantly share code, notes, and snippets.

@muhtarudinsiregar
Last active April 7, 2017 08:28
Show Gist options
  • Select an option

  • Save muhtarudinsiregar/13102fb9b6f67e9b24b690a776f947ff to your computer and use it in GitHub Desktop.

Select an option

Save muhtarudinsiregar/13102fb9b6f67e9b24b690a776f947ff to your computer and use it in GitHub Desktop.
Case Study11.php
return values from multidimensional array
$users = [
[
'id' => 1,
'name' => 'Adimas Lutfi Wicaksono',
],
[
'id' => 2,
'name' => 'Salman Alfarisi',
],
[
'id' => 3,
'name' => 'Muhammad Sholeh',
],
[
'id' => 4,
'name' => 'Yadi Cahyadi',
],
[
'id' => 5,
'name' => 'Maya Maulani',
],
];
$names = [];
foreach ($users as $key => $value) {
$names[$key] = $value['name'];
}
print_r($names);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment