returning an array
| From: | jim davis | Date: | Thu, 11 Jan 2001 18:53:52 +0000 |
| Subject: | returning an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-34062@lists.php.net to get a copy of this message | ||
Hello again! Ok, so I will give up the idea of calling a function from
one php page and having that function return its value to another php
page... BUT I was looking at the "php handbook" and found that I could
return an array! this is the example thay gave:
function small_numbers() {
return array (0, 1, 2);
}
list ($zero, $one, $two) = small_numbers();
ok, that works fine for small arrays, but what if I had an array that
was 20 or more elements big? Is there a way of returning a generic
sized array? such as 'return array ($var[]);' ? I tried it, and it
yelled at me, so I know that the above syntax is wrong, but is there an
"easier" way?
Thanks!
-Jim