From arrayOf(2,10,3,5,20,100,7,9,80) print out all the numbers that are multiples of 10 In PHP | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

From arrayOf(2,10,3,5,20,100,7,9,80) print out all the numbers that are multiples of 10 In PHP

Array

16th Apr 2020, 9:25 PM
d1_codes
d1_codes - avatar
2 Answers
+ 2
<?php $func = function ($el) { return $el % 10 == 0; }; $arr = array(2,10,3,5,20,100,7,9,80); $arr = array_filter($arr, $func); echo implode(", ", $arr); ?>
16th Apr 2020, 10:22 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Thank you very much
17th Apr 2020, 12:15 PM
d1_codes
d1_codes - avatar