RE: [PHP] Fwd: functions returning arrays
| From: | Johnson, Kirk | Date: | Fri, 24 Aug 2001 15:30:27 +0000 |
| Subject: | RE: [PHP] Fwd: functions returning arrays | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-64269@lists.php.net to get a copy of this message | ||
Try "echo "$r[$i]" instead of echo "$r[i]".
Kirk
> -----Original Message-----
> From: Frank Loewenthal [mailto:frank.loewenthal@freesurf.ch]
> Sent: Friday, August 24, 2001 9:33 AM
> To: php-general@lists.php.net
> Subject: [PHP] Fwd: functions returning arrays
>
>
> Hi
>
> Perhaps I am confused, but is it not possible to return arrays in PHP?
>
> Example:
>
> function getArray() {
> $ret = array('hallo','you');
> return $ret;
> }
>
> $r = getArray();
>
> for( $i=0;$i < count($r); $i++)
> echo "$r[i]";
>
> Does not work! The array shows 2 Elements, but they are emty
>
> Hm... Where is do mistake?