returning an array from a function?
4 Message(s) by 3 Author(s) originally posted in php general
| From: info |
Date: Friday, October 26, 2007
|
Hello all,
function convert( $latitude, $longitude ) {
$mve_latitude = $latitude; // actually other
processing within this function determines this
$mve_longitude = $longitude // actually other processing within this function determines this
$mve_both = $mve_latitude . ", " . $mve_longitude;
// prepare return values
$mve_
array [0] = $mve_latitude;
$mve_array[1] = $mve_longitude;
$mve_array[2] = $mve_both;
return $mve_array;
} // function
$latitude = 23.263400;
$longitude = 80.110030
convert( $latitude, $longitude );
print_r( $mve_array );
.. the above doesn't return a value in the array. What do I have to change to receive an array with global scope from this function? I read several pages of docs on php.net but the light did not go on...
Sincerely,
Rob.
| From: simon |
Date: Friday, October 26, 2007
|
$mve_array = convert( $latitude, $longitude );
or, in convert(), before the first call to $mve_array:
wrote in message:
Hello all,
function convert( $latitude, $longitude ) {
$mve_latitude = $latitude; // actually other processing within this
function determines this
$mve_longitude = $longitude // actually other processing within
this function determines this
$mve_both = $mve_latitude . ", " . $mve_longitude;
// prepare return values
$mve_array[0] = $mve_latitude;
$mve_array[1] = $mve_longitude;
$mve_array[2] = $mve_both;
return $mve_array;
} // function
$latitude = 23.263400;
$longitude = 80.110030
convert( $latitude, $longitude );
print_r( $mve_array );
.. the above doesn't return a value in the array. What do I have
to change to receive an array with global scope from this function?
I read several pages of docs on php.net but the light did not go on...
Sincerely,
Rob.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
---
Simon Welsh
Admin of
http://simon.geek.nz/
Windows is a joke operating system. Hell, it's not even an operating
system. NT isn't Tough enough for me either. 95 is how may times it
will
crash an hour.
http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e
| From: tedd.sperling |
Date: Friday, October 26, 2007
|
wrote in message:
Hello all,
function convert( $latitude, $longitude ) {
$mve_latitude = $latitude; // actually other processing within this
function determines this
$mve_longitude = $longitude // actually other processing within this
function determines this
$mve_both = $mve_latitude . ", " . $mve_longitude;
// prepare return values
$mve_array[0] = $mve_latitude;
$mve_array[1] = $mve_longitude;
$mve_array[2] = $mve_both;
return $mve_array;
} // function
$latitude = 23.263400;
$longitude = 80.110030
convert( $latitude, $longitude );
print_r( $mve_array );
.. the above doesn't return a value in the array. What do I have to
change to receive an array with global scope from this function? I
read several pages of docs on php.net but the light did not go on...
Sincerely,
Rob.
Rob:
Why use a global?
Plus, your function is returning an array, but you're not catching it.
$mve_array = convert( $latitude, $longitude );
Example:
http://www.webbytedd.com/bbb/array-function/
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
| From: info |
Date: Saturday, October 27, 2007
|
Hello List,
Your help produced a refined function. The function converts a
Google Map latitude and longitude into an equivalent
Microsoft Virtual Earth latitude and longitude.
Here is an example of how the function works, along with
source code:
http://www.globalissa.com/articles/convert_google_to_mve_array_doc.php
Thank you to Ted and others who helped.
sincerely,
wrote in message:
>Hello all,
>
>function convert( $latitude, $longitude ) {
>
>$mve_latitude = $latitude; // actually other processing within this
>function determines this
>$mve_longitude = $longitude // actually other processing within this
>function determines this
>$mve_both = $mve_latitude . ", " . $mve_longitude;
>// prepare return values
>$mve_array[0] = $mve_latitude;
>$mve_array[1] = $mve_longitude;
>$mve_array[2] = $mve_both;
>
>return $mve_array;
>} // function
>
>$latitude = 23.263400;
>$longitude = 80.110030
>convert( $latitude, $longitude );
>
>print_r( $mve_array );
>
>.. the above doesn't return a value in the array. What do I have to
>change to receive an array with global scope from this function? I
>read several pages of docs on php.net but the light did not go on...
>
>Sincerely,
>Rob.
Rob:
Why use a global?
Plus, your function is returning an array, but you're not catching it.
$mve_array = convert( $latitude, $longitude );
Example:
http://www.webbytedd.com/bbb/array-function/
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
Next Message: session lost when stepping into a function
Blogs related to returning an array from a function?
BUILDING UNIVERSES: THE MONARCHY
Maxwell - Comixfan Assistant Columns Editor Next Week: WorldStorm: Phase Three For more events and bios, be sure to check out Comixfan Resources (http://www.comixfan.com/xfan/forums/forumdisplay.
php?f=46)!
ppl heres my question the code for imagerotate example pasted from ...
I think I remember a
function that takes an
array and returns the distinct values in that
array.. what is it? or am I mistaken? ahh. array_unique. hello, when using phpdoc generator, can i also use normal
php comments (//some comment) ?
...
Review Party: Emptying The Big Basket
From this issue, and the introduction of a sister character when there's so much work to be done at home and on the job, I think it's
turning out that way for Brit. ***** Title: Nog A Dod Creators: Various Publishing Information:
...
Looping through array trickier than expected
Hi, I'm trying to loop through a multi-dimentional
array to pull out certain values, but the nature of it means that trying to do it without writing an obscenely long
function is slowly
turning my brain to mush now.
...
C QUESTIONS
How will you declare an
array of three
function pointers where each
function receives two ints and returns a float? what is a NULL Pointer? Whether it is same as an uninitialized pointer? What is a NULL Macro?
...
PIM Team Case Study: Creating Text Effects With PHP and GD
We created a
PHP cycle which was taking the colors from the database and then creating a string for HTML table. This table is then passed to a javascript
function which creates the palletes with the help of hidden layers:
...