foreach() over a list of arrays?
| From: | Eric Pretorious | Date: | Thu, 01 Jan 1970 00:00:00 +0000 |
| Subject: | foreach() over a list of arrays? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-147179@lists.php.net to get a copy of this message | ||
Hello, All:
I'm a veteran Perl programmer who's used to things like...
@array1 = qw(one two three);
@array2 = qw(four five);
foreach $element (@array1, @array2) {
# Do something...
}
Is there any way to do this in PHP? e.g.,
$coach = 'fred';
$manager = 'fred';
$asst_coaches = array('wilma','barney');
foreach ($coach,$manager,$asst_coaches as $staff_member) {
print $staff_member;
}
--
Eric P.
Sunnyvale, CA