0

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?

2 Answers 2

1
$result[0]->lat
Sign up to request clarification or add additional context in comments.

2 Comments

Easy enough, thanks for the help. It does require the -> and EAMann's solution did not work
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).
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.