Here’s a quick way to remove all alpha characters from an array using PHP closures (PHP 5.3+)
array_walk($myarray, function(&$element){ $element = trim($element,"ABCDEFGHIJKLMNOPQRSTUVWXYZ"); });
You can also remove all numbers from an array similarly
array_walk($myarray, function(&$element){ $element = trim($element,"0123456789"); });
The variable must be passed by reference in order to change the values of the original array. I really like the addition of closures, which reduces the need to create a new method for simple operations.