Created
November 1, 2015 14:32
-
-
Save tryvin/8c00e95e2775ed4ad757 to your computer and use it in GitHub Desktop.
Lambda example 2
This file contains 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 | |
$myDatabaseArray = array( | |
array( | |
'databaseId' => 1, | |
'databaseValue' => 'Hello' | |
), | |
array( | |
'databaseId' => 2, | |
'databaseValue' => 'World' | |
) | |
); | |
$toSmartyArray = array(); | |
array_map(function($arrayElement) use(&$toSmartyArray) { | |
$toSmartyArray[$arrayElement['databaseId']] = $arrayElement['databaseValue']; | |
}, $myDatabaseArray); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment