ok i have 2 arrays
the 1st array looks like this aaa,bbb,ccc,ddd
the 2nd array looks like this 1,4,3,7
i want the output to be this
aaa - 1
bbb - 4
ccc - 3
ddd - 7
i tried a foreach loop inside another foreach loop but that clearly was not the answer. any sugestions?
array quick q
Moderator: General Moderators
- feyd
- Neighborhood Spidermoddy
- Posts: 31559
- Joined: Mon Mar 29, 2004 3:24 pm
- Location: Bothell, Washington, USA
two waysboth requires numeric indices in the arrays.
Code: Select all
for($i = 0, $j = count($arr1); $i < $j; $i++)
echo $arr1ї$i] . ' - ' . $arr2ї$i] . "\n";Code: Select all
foreach($arr1 as $i => $v)
echo $v . ' - ' . $arr2ї$i] . "\n";