note 11392 added to array_intersect

From: Date: Mon, 19 Feb 2001 12:52:25 +0000
Subject: note 11392 added to array_intersect
Groups: php.notes 
Request: Send a blank email to php-notes+get-11246@lists.php.net to get a copy of this message
Here is the equivalent to array_intersect for PHP3 users : function array_intersect($array1, $array2) { if (sizeof($array1) > sizeof($array2)) { $array3 = $array2; $array2 = $array1; $array1 = $array3; } $endarray = array (0 => 0); $j = 0; for ($i = 0; $i < sizeof($array1); $i++) { if (in_array($array1[$i], $array2)){ $endarray[$j] = $array1 [$i]; $j++; } } return ($endarray); } http://www.php.net/manual/en/function.array-intersect.php

« previous php.notes (#11246) next »