Hướng dẫn dùng intersection array trong PHP
Định nghĩa hàm array_intersect() trong PHP__Hàm Show Cú pháp hàm array_intersect() trong PHPHàm
Tham số
Trả về giá trị Trả về mảng chứa tất cả đầu vào của mảng array1 mà không có mặt trong tất cả mảng khác. Ví dụ minh họa cách sử dụng hàm array_intersect() trong PHP:
Lưu chương trình trên trong một file có tên là test.php trong htdocs, sau đó mở trình duyệt và gõ địa chỉ http://localhost:8080/test.php sẽ cho kết quả: Xem thêm Hàm trong php (PHP 4 >= 4.0.1, PHP 5, PHP 7, PHP 8) array_intersect — Computes the intersection of arrays Descriptionarray_intersect(array Parametersarray The array with master values to check. arrays Arrays to compare values against. Return Values Returns an array containing all of the values in Changelog
ExamplesExample #1 array_intersect() example
The above example will output: Array ( [a] => green [0] => red ) Notes
See Also
stuart at horuskol dot co dot uk ¶ 14 years ago
= array(2, 4, 6, 8, 10, 12); Niels ¶ 15 years ago
Shawn Pyle ¶ 13 years ago
sapenov at gmail dot com ¶ 17 years ago
blu at dotgeek dot org ¶ 17 years ago
[0] = array('John Doe', 'PHP Book'); yuval at visualdomains dot com ¶ 7 years ago
= range(1,1000000); dml at nm dot ru ¶ 11 years ago
matang dot dave at gmail dot com ¶ 7 years ago
info at iridsystem dot it ¶ 7 years ago
Esfandiar -- e.bandari at gmail dot com ¶ 14 years ago
theking at king dot ma ¶ 4 months ago
Anonymous ¶ 1 year ago
Ehsan.Chavoshi.com ¶ 3 years ago
Yohann ¶ 12 years ago
Oto Brglez ¶ 13 years ago
= array(); Malte ¶ 14 years ago
nthitz at gmail dot com ¶ 16 years ago
t dot wiltzius at insightbb dot com ¶ 18 years ago
anbolb at boltblue dot com ¶ 18 years ago
caffinated ¶ 9 years ago
terry(-at-)shuttleworths(-dot-)net ¶ 16 years ago
tom p ¶ 16 years ago
ben at kazez dot com ¶ 18 years ago
Mike Block ¶ 9 years ago
david at audiogalaxy dot com ¶ 21 years ago
gary ¶ 13 years ago
$numbers;
meihao at 126 dot com ¶ 8 years ago
zoolyka at gmail dot com ¶ 3 years ago
= range(1, 250000); ram ¶ 4 years ago
karl at libsyn dot com ¶ 13 years ago
findMatchingArray( $needle, $haystack ) {
189780 at gmail dot com ¶ 12 years ago
jake ¶ 5 years ago
|