Reply to Re: Why are these so brilliantly hidden when it comes to PHP's functions...?

Your name:

Reply:


Posted by Rik Wasmus on 01/04/08 13:41

On Fri, 04 Jan 2008 14:25:28 +0100, <adam.timberlake@gmail.com> wrote:

> I was reading the following article yesterday:
> http://www.talkphp.com/vbarticles.php?do=3Darticle&articleid=3D41&titl=
e=3Dusing-the-internal-array-pointers-to-access-elements-in-arrays
>
> What struck me while reading it was how very little we hear about the
> array internal pointers !! I've been in PHP now for a good 2 years,
> and I've never heard these little guys mentioned before.

It's because most of array actions can be done much more effectively & =

transparant with foreach() loops.
Before that, we had to do something like this:

$array =3D array(1,2,3,4,5,6);
//some code
reset($array);
while($item =3D each($array)){
echo "Key =3D ".$item['key'];
echo "Value =3D ".$item['value'];
}

> My question is... what do you use internal pointers for, and why?

Normally, I don't use an arrays pointer in PHP. Foreach is quite enough =
=

usually (possibly with an continue statement), and I use references to =

array items if not.
-- =

Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация