Q: How to replace all array values with one character in PHP? If I have this array: $array = ['1', '2', '3'];
I would like to replace all values in that array with asterisk sign *.
Essentially, I want to get array like this: $new = ['*', '*', '*'];.
What is the best way to do this ? I am hoping that there is some short simple solution for this.
Thanks in advance.

A: <?php
$array = ['1', '2', '3'];
$newarray = array_map(function($val) { return "*"; }, $array);
?>

