Inspekt\Inspekt::getAlpha PHP Method

getAlpha() public static method

Returns only the alphabetic characters in value.
public static getAlpha ( mixed $value ) : mixed
$value mixed
return mixed
    public static function getAlpha($value)
    {
        if (Inspekt::isArrayOrArrayObject($value)) {
            return Inspekt::walkArray($value, 'getAlpha');
        } else {
            return preg_replace('/[^[:alpha:]]/', '', $value);
        }
    }

Usage Example

Beispiel #1
0
 /**
  *
  */
 public function testGetAlpha()
 {
     $input = '0qhf01 *#R& !)*h09hqwe0fH! )efh0hf';
     $output = 'qhfRhhqwefHefhhf';
     $this->assertTrue(Inspekt::getAlpha($input) === $output);
     $input = array('1241DOSLDH', 'efoihr123-', 'eoeijfo1');
     $output = array('DOSLDH', 'efoihr', 'eoeijfo');
     $this->assertEquals(Inspekt::getAlpha($input), $output);
 }