Jump to content

Help with this array


dhimo

Recommended Posts

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
Share on other sites

i believe you could do something like this

<?php$array1[] = 57;$array1[] = 60;$array2[57] = 'one';$array2[58] = 'two';$array2[59] = 'three';$array2[60] = 'four';$variable = $array2[$array1[1]];?>

substituting the second 1 in "$array1[1]" for the key of the value you want to use from array 1your welcome in advance :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...