coder1.com

  • home
  • drupal articles
  • contact
Home

Control Structures

PHP foreach value by reference

Mike Milano — July 1, 2008 - 10:49pm

[img_assist|nid=9|title=|desc=|link=none|align=right|width=100|height=66] PHP5 added a very subtle yet very handy feature in the foreach Control Structure. It is the ability to access the value in the iteration as a reference to the original array.

The best way to demonstrate this is to establish an objective.

Objective: Write a function to capitalize all elements of an array.

  • Control Structures
  • PHP
  • Add new comment
  • Read more
Syndicate content

Poll

Have you checked out Drupal 7 yet? (still alpha):

User login

  • Request new password

Navigation

  • Recent posts
  • home
  • drupal articles
  • contact