Re: [PHP] returning an array from a function?
On 10/26/07, tedd [EMAIL PROTECTED] wrote: 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 So... do you write some of these pages on-the-fly when you see someone needing assistance from the list? or you have this repository of scripts? =D ~Philip
Re: [PHP] returning an array from a function?
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, Rob At 12:09 AM -0700 10/26/07, [EMAIL PROTECTED] wrote: 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 does not 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 didn't 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] returning an array from a function?
At 5:38 AM -0700 10/27/07, [EMAIL PROTECTED] wrote: 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. Oh no, don't tell me that I helped the Dark-side -- there is a disturbance in the force, Luke. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] returning an array from a function?
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 does not 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 didn't go on... Sincerely, Rob. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] returning an array from a function?
$mve_array = convert( $latitude, $longitude ); or, in convert(), before the first call to $mve_array: global $mve_array; On 26/10/2007, at 8:09, [EMAIL PROTECTED] wrote: 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 does not 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 didn't 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 is Not Tough enough for me either. 95 is how may times it will crash an hour. http://www.thinkgeek.com/brain/gimme.cgi?wid=81d520e5e -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] returning an array from a function?
At 12:09 AM -0700 10/26/07, [EMAIL PROTECTED] wrote: 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 does not 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 didn't 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Returning an array in a function
How would I return an array of data with a function? Robbert van Andel The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from all computers.
Re: [PHP] Returning an array in a function
At 18:23 19.11.2002, Van Andel, Robert spoke out and said: [snip] How would I return an array of data with a function? [snip] // returns a copy of the array function return_an_array() { $a = array('oranges','apples','bananas'); return $a; } // returns a reference to the array function return_an_arrayref() { $a = array('oranges','apples','bananas'); return $a; } // get the copied array $ar = return_an_array(); // get the referenced array $ar = get_an_arrayref(); // get a copy even if a reference is returned $ar = get_an_arrayref(); -- O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/