Source Code:
(back to article)
<?php $numbers = [1, 2, 3, 4, 5]; function square($n) { return $n * $n; } $squared = array_map('square', $numbers); print_r($squared); ?>
Result:
Report an issue