Last active
August 29, 2015 14:17
-
-
Save codex73/41c8e1787db4750b6ec6 to your computer and use it in GitHub Desktop.
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 | |
| // Multi Dimensional Array Search | |
| private function searchForId($id, $array) | |
| { | |
| $value = ''; | |
| foreach ($array as $key => $val) | |
| { | |
| if ($val['hotel_PPID'] == $id) | |
| { | |
| $value = $key; | |
| break; | |
| } | |
| } | |
| //extra logi | |
| if(! empty($value)) | |
| { | |
| //do something else | |
| } | |
| return $value; | |
| } | |
| // Usage | |
| if(! empty($this->searchForId($hotel_id,$this->hotelsInfos->hotels_infos))) | |
| { | |
| $bestRate[$hotel_id][$this->current_occupancy]['currency'] = (string)$prices->name; | |
| $bestRate[$hotel_id][$this->current_occupancy]['price'] = (string)$prices->value->double; | |
| } | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment