I have two json file, and need to sync them, if changes found, below is my json file,
is parent(P) and another one
is child(C),
Here is my code :
foreach ($localJson->PushNotification as $key => $data ) {
foreach ($this->news as $news ) {
if($news->pushMessageId == $data->pushMessageId){
if($news->Image != "" && $news->Image != $data->Image){
echo "new image found <br />";
}
if($news->documentFile != "" && $news->documentFile != $data->documentFile){
echo "new documentFile found <br />";
}
if($news->categoryIcon != "" && $news->categoryIcon != $data->categoryIcon){
echo "new categoryIcon found <br />";
}
}
}
}
The Problem is everytime when it loops, it doesent discard previous loops value, if current found to be empty
For Ex: 1st loop 1653 pushMessageId compares pdf and updates in child, but for next pushMessageId again it takes same pdf to compare, rather then taking empty field.