For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > July 2007 > reading Array









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author reading Array
pigiakeys@gmail.com

2007-07-27, 7:00 pm

I have an array with N values, I want read it from the position X to
the end of array...how can I do?

Webrickco

2007-07-27, 7:00 pm

On Jul 27, 2:02 pm, pigiak...@gmail.com wrote:
> I have an array with N values, I want read it from the position X to
> the end of array...how can I do?


for ($i=X;$i<count($array);i++) {
echo $array[$i];
}

Hendri Kurniawan

2007-07-27, 7:00 pm

pigiakeys@gmail.com wrote:
> I have an array with N values, I want read it from the position X to
> the end of array...how can I do?
>


This is a manual to manipulate array
http://au2.php.net/manual/en/ref.array.php

Specifically: http://au2.php.net/manual/en/function.array-slice.php

Hendri Kurniawan
David Gillen

2007-07-27, 7:00 pm

pigiakeys@gmail.com said:
> I have an array with N values, I want read it from the position X to
> the end of array...how can I do?
>


foreach(array_slice($yourArray, $X) as $var)
{
// do your stuff on $var
}

D.
--
Fermat was right.
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com