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 Link to comment https://forums.phpfreaks.com/topic/54777-solved-array-help/ 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 />"; } ?> Link to comment https://forums.phpfreaks.com/topic/54777-solved-array-help/#findComment-270886 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 Link to comment https://forums.phpfreaks.com/topic/54777-solved-array-help/#findComment-270935 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.