Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Why not use a foreach loop instead of having a function called array_walk?

2 views
Skip to first unread message

adam.ti...@gmail.com

unread,
Jan 7, 2008, 8:27:55 PM1/7/08
to
I was reading this article yesterday:
http://www.talkphp.com/advanced-php-programming/1886-how-would-i-apply-htmlentities-every-array-item.html

I am wondering.. okay.. we can use array_walk but doesn't that just
loop through the items anyway ?? So why not just use the foreach loop
instead... is it a shorthand trick or is there any deeper reasoning
behind it... Thats my question!

I do have another question and that is if it is a shorthand version,
having a foreach loop isn't much more in terms of the letters you type
and so why have the PHP developers put it in there ??

It's puzzling me. Thank you in advance.

0 new messages