判断A数组的数目字是否大于B数组

WBOY
Release: 2016-06-13 12:15:01
Original
836 people have browsed it

判断A数组的数字是否大于B数组
$a=array(50,20,10);
$b=array(30,15,5);

我两个数组都先按大小排序了,请问怎么判断数组a相应位置的数组都大于等于数组b。如果有a中一个数字小于b都判断定false

比如50>30,20>15,10>5  
------解决思路----------------------

$a = array(50,20,10);<br />$b = array(30,15,5);<br /><br />$c = array_map(function($a, $b) { return $a >= $b ? 1 : 0; }, $a, $b);<br />if(array_product($c)) echo '都大于等于';
Copy after login

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!