tags:

views:

15

answers:

2

Sorry for such a basic question. I have a snippet in which the var_dump($result) returns



array(1) {
  [0]=>
  object(stdClass)#2 (10) {
    ["number"]=>
    int(1600)
    ["zip"]=>
    int(20502)
    ["suffix"]=>
    string(2) "NW"
    ["prefix"]=>
    string(0) ""
    ["type"]=>
    string(3) "Ave"
    ["street"]=>
    string(12) "Pennsylvania"
    ["state"]=>
    string(2) "DC"
    ["city"]=>
    string(10) "Washington"
    ["lat"]=>
    float(38.898748)
    ["long"]=>
    float(-77.037684)
  }
}

How do I get the "lat" value as a string so I can insert it into a database?

+1  A: 

$result[0]->lat

a1ex07
Easy enough, thanks for the help. It does require the -> and EAMann's solution did not work
Crunchline
My mistake ... it was an object, not an array. I should have put `$latitude = (string) $result[0]->lat;`Oh, and if a1ex07's answer was correct, make sure you mark it as the correct answer (click the checkmark).
EAMann
A: 

$latitude = (string) $result[0]->lat;

EAMann