php – 从数组中获取过滤值,范围为10-20

前端之家收集整理的这篇文章主要介绍了php – 从数组中获取过滤值,范围为10-20前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
如何从数组中获取过滤值,如10-20范围内的值.
我的数组包含10,15,18,25,88,20.
我想只在10-20范围内打印.
使用 array_intersectrange
$input = array(10,20);
$myrange = range(10,20);
$output = array_intersect($input,$myrange );
print_r($output );

DEMO

原文链接:https://www.f2er.com/php/133152.html

猜你在找的PHP相关文章