Considering an array of strings:
$array = ('hello', 'hello1', 'hello2');
I need to preg_quote($value,'/'); each of the values.
I want to avoid using foreach. Array walk doesn’t work because it passes the key too.
array_walk($array,'preg_quote','/'); //> Errors, third parameter given to preg_quote
Any alternative?
Try
array_map()[doc] with an anonymous function (>= 5.3):Working demo