Home »
Imported messages »
comp.lang.php »
r/w internal array pointer
Re: r/w internal array pointer [message #176335 is a reply to message #176331] |
Fri, 23 December 2011 09:40 |
alvaro.NOSPAMTHANX
Messages: 277 Registered: September 2010
Karma:
|
Senior Member |
|
|
El 22/12/2011 23:09, Olaf S. escribió/wrote:
> Am 22.12.2011 19:08, schrieb oldyork90:
>>
>> There are reset() and end() functions for array pointer P
>> manipulation. Is there a way to set or read it directly? P = 3?
>>
>>
>> loop
>> next($a);
>> break on some count
>>
>> seems to be the only way to do it.
>>
>> Thank you.
>
>
> $x = $a[3];
The square bracket operator does not seem to alter the array pointer:
<?php
$foo = range(0, 99);
var_dump(next($foo));
var_dump(next($foo));
$foo[50];
var_dump(next($foo));
?>
.... prints this:
int(1)
int(2)
int(3)
Array pointers are not very practical but I suppose the are not widely
used anyway.
--
-- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web: http://borrame.com
-- Mi web de humor satinado: http://www.demogracia.com
--
|
|
|
Goto Forum:
Current Time: Tue Nov 26 17:34:47 GMT 2024
Total time taken to generate the page: 0.06485 seconds