Hi
I have a question regarding array_intersect () in PHP 4.3. There are several
arrays created on the fly, such as:
$values['apples'];
$values['bananas'];
$values['pears'];
To extract only the values they have in common I tried this:
$command = "array_intersec t(";
for ($i=0; $i<count($value s); $i++) {
$command .= "\$values['$values[$i]'],";
}
$command = substr($command , 0, -1);
$command .= ");";
$result = eval($command);
This does not seem to work and also is quite complicated. Does somebody know
a better solution?
Thanks
Markus
I have a question regarding array_intersect () in PHP 4.3. There are several
arrays created on the fly, such as:
$values['apples'];
$values['bananas'];
$values['pears'];
To extract only the values they have in common I tried this:
$command = "array_intersec t(";
for ($i=0; $i<count($value s); $i++) {
$command .= "\$values['$values[$i]'],";
}
$command = substr($command , 0, -1);
$command .= ");";
$result = eval($command);
This does not seem to work and also is quite complicated. Does somebody know
a better solution?
Thanks
Markus
Comment