note 5568 deleted from Arrays by ronabop
| From: | ronabop@php.net | Date: | Fri, 25 Aug 2000 08:57:27 +0000 |
| Subject: | note 5568 deleted from Arrays by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-3186@lists.php.net to get a copy of this message | ||
I'm trying to run a "for loop" using a pointer to the first array element, such as is
possible in C. Here is what I tried to do using the "indirection operator" (*):
$arr[0] = "<p>first entry</p>";
$arr[1] = "<p>second entry</p>";
$arr[2] = 7;
for ($pointer = $arr; $pointer < $arr + 2; $pointer++)
echo *$pointer;
I know that this doesn't work, as I recieve an error message, but can anyone tell me what the
indirection operator is for PHP (if there is one), and if so, how to implement the above code.
Additionally, is the "address operator" (&) used in the same way as in C? Thank you
all for you help and patience.