Re: array_intersect question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> The question is how to perform intersection on the following structure:
>
> $products =
> array(array("green","red","blue"),array("green","yellow","red"),array("green","red","purple"),array("green","red","yellow"));

If I understood you correctly ..

<?php
$arr = array();
$arr[] = array("green", "red", "blue");
$arr[] = array("green", "yellow", "red");
$arr[] = array("green", "red", "purple");
$arr[] = array("green","red","yellow");
var_dump($arr);
// you could also ..
$arr = array();
array_push(
	$arr, array("green", "red", "blue"),
	array("green", "yellow", "red"),
	array("green", "red", "purple"),
	array("green","red","yellow")
);
var_dump($arr);
?>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux