Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ## the $apartments array
- // generate info about each apartment
- $i = 0;
- foreach ($query->result() as $apartment) {
- $apt_id = $apartment->apt_id;
- $distance = getDistance($user_latitude, $user_longitude, $apartment->latitude, $apartment->longitude, true);
- $office_id = $apartment->office_id;
- $address = $apartment->address;
- $city = $apartment->city;
- $apt_lat = $apartment->latitude;
- $apt_lng = $apartment->longitude;
- $price = $apartment->price;
- $description = $apartment->description;
- $url = $apartment->url;
- $apartments[$i] = array("apt_id" => $apt_id, "distance" => $distance, "office_id" => $office_id, "address" => $address, "city" => $city, "latitude" => $apt_lat, "longitude" => $apt_lng, "price" => $price, "description" => $description, "url" => $url);
- $i++;
- }
- ## var_dump of the array
- array(7) { [0]=> array(10) { ["apt_id"]=> string(1) "5" ["distance"]=> float(0.381934319893) ["office_id"]=> NULL ["address"]=> string(12) "408 E. Green" ["city"]=> NULL ["latitude"]=> string(9) "40.110290" ["longitude"]=> string(10) "-88.232471" ["price"]=> string(6) "790.00" ["description"]=> NULL ["url"]=> NULL } [1]=> array(10) { ["apt_id"]=> string(2) "13" ["distance"]=> float(1.19183884197) ["office_id"]=> NULL ["address"]=> string(16) "1010 W Stoughton" ["city"]=> NULL ["latitude"]=> string(9) "40.113658" ["longitude"]=> string(10) "-88.221738" ["price"]=> string(6) "979.00" ["description"]=> NULL ["url"]=> NULL } [2]=> array(10) { ["apt_id"]=> string(1) "4" ["distance"]=> float(1.49066584753) ["office_id"]=> NULL ["address"]=> string(26) "310 Cedar Street Apt. #102" ["city"]=> NULL ["latitude"]=> string(9) "40.099015" ["longitude"]=> string(10) "-88.246785" ["price"]=> string(6) "850.00" ["description"]=> NULL ["url"]=> NULL } [3]=> array(10) { ["apt_id"]=> string(1) "2" ["distance"]=> float(3.2804822338) ["office_id"]=> NULL ["address"]=> string(19) "705 E. Colorado Ave" ["city"]=> NULL ["latitude"]=> string(9) "40.094554" ["longitude"]=> string(10) "-88.197513" ["price"]=> string(6) "905.00" ["description"]=> NULL ["url"]=> NULL } [4]=> array(10) { ["apt_id"]=> string(2) "17" ["distance"]=> float(1.05130998458) ["office_id"]=> NULL ["address"]=> string(11) "305 E. John" ["city"]=> NULL ["latitude"]=> string(9) "40.115906" ["longitude"]=> string(10) "-88.228991" ["price"]=> string(7) "1200.00" ["description"]=> NULL ["url"]=> NULL } [5]=> array(10) { ["apt_id"]=> string(1) "9" ["distance"]=> float(1.20585983045) ["office_id"]=> NULL ["address"]=> string(22) "1002 W Springfield Ave" ["city"]=> NULL ["latitude"]=> string(9) "40.113018" ["longitude"]=> string(10) "-88.220901" ["price"]=> string(6) "725.00" ["description"]=> NULL ["url"]=> NULL } [6]=> array(10) { ["apt_id"]=> string(2) "12" ["distance"]=> float(0.592903542996) ["office_id"]=> NULL ["address"]=> string(12) "101 E. Green" ["city"]=> NULL ["latitude"]=> string(9) "40.109834" ["longitude"]=> string(10) "-88.238352" ["price"]=> string(6) "950.00" ["description"]=> NULL ["url"]=> NULL } }
Add Comment
Please, Sign In to add comment