Created
January 7, 2014 19:59
-
-
Save matula/8305867 to your computer and use it in GitHub Desktop.
loop through an array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$social_data = [ | |
[ | |
'first' => 'John', | |
'middle' => 'Smith', | |
'last' => 'Doe', | |
'email' => '[email protected]' | |
], | |
[ | |
'first' => 'John', | |
'last' => 'Doe', | |
'email' => '[email protected]' | |
], | |
[ | |
'first' => 'John', | |
'last' => 'Doe', | |
] | |
]; | |
$new = []; | |
foreach ($social_data AS $d) | |
{ | |
$new[] = [ | |
'full_name' => $d['first'] . ' ' . $d['middle'] . ' ' . $d['last'], | |
'email_address' => $d['email'] | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment