πŸ“Š PHP
Q. What will be the output?
Code:
$a = [1,2,3];
$b = array_map(function($v){ return $v*2; }, $a);
echo implode(',', $b);
  • (A) 1,2,3
  • (B) 2,4,6
  • (C) 3,6,9
  • (D) Error
πŸ’¬ Discuss
βœ… Correct Answer: (B) 2,4,6

Explanation: array_map doubles each element.

Explanation by: Roshan
array_map doubles each element.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
2
Total Visits
πŸ“½οΈ
8 d ago
Published
πŸŽ–οΈ
Roshan
Publisher
πŸ“ˆ
86%
Success Rate