Skip to content

Instantly share code, notes, and snippets.

@tryvin
Created November 1, 2015 14:07
Show Gist options
  • Save tryvin/430e0e74a50d8b8bd03b to your computer and use it in GitHub Desktop.
Save tryvin/430e0e74a50d8b8bd03b to your computer and use it in GitHub Desktop.
PHP lambda example - 1
<?php
$myDatabaseArray = array(
array(
'databaseId' => 1,
'databaseValue' => 'Hello'
),
array(
'databaseId' => 2,
'databaseValue' => 'World'
)
);
$toSmartyArray = array();
foreach($myDatabaseArray as $arrayElement) {
$toSmartyArray[$arrayElement['databaseId']] = $arrayElement['databaseValue'];
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment