dhimok Posted June 8, 2007 Share Posted June 8, 2007 Hi everyone. I have these two arrays: <?php $array1[] = 57; $array1[] = 60; $array2[57] = 'one'; $array2[58] = 'two'; $array2[59] = 'three'; $array2[60] = 'four'; ?> I want to select from array2 those values where key in array2 is equal to value in array1. Is this possible? Thanks in advanced Quote Link to comment Share on other sites More sharing options...
per1os Posted June 8, 2007 Share Posted June 8, 2007 <?php foreach ($array1 as $val) { echo $array2[$val] . "<br />"; } ?> Quote Link to comment Share on other sites More sharing options...
dhimok Posted June 8, 2007 Author Share Posted June 8, 2007 That's what I was looking for. Thanks Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.