r/w internal array pointer [message #176330] |
Thu, 22 December 2011 18:08 |
oldyork90
Messages: 9 Registered: December 2011
Karma: 0
|
Junior Member |
|
|
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.
|
|
|
Re: r/w internal array pointer [message #176331 is a reply to message #176330] |
Thu, 22 December 2011 22:09 |
Olaf S.
Messages: 10 Registered: December 2011
Karma: 0
|
Junior Member |
|
|
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];
|
|
|
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: 0
|
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
--
|
|
|