Created
July 16, 2015 12:55
-
-
Save jimjamdev/f4daa50fe511350b7697 to your computer and use it in GitHub Desktop.
Comparing arrays in Yii
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
$settings = CHtml::listData(GeneralSettings::model()->findAll("`group` = 'email'"), "setting", "value"); | |
$collectLogData = array( | |
"emailServer" => $post["emailServer"], | |
"emailPort" => $post["emailPort"], | |
"emailUsername" => $post["emailUsername"], | |
"emailPassword" => $post["emailPassword"], | |
"emailEncryption" => $post["encryption"], | |
"emailAuth" => $post["emailAuthentication"], | |
); | |
// Compare posted data array with currently saved settings array, and remove key if no difference | |
$compareData = array_diff($collectLogData, $settings); | |
$logData = $compareData; | |
$logList = '<br><br><ul class="list">'; | |
foreach ($logData as $key=>$value) { | |
$logList .= '<li>' . $key . ': ' . $value . '</li>'; | |
} | |
$logList .= '</ul>'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment