Also accepts latin numbers preventing potential problem until PHP becomes fully unicode compatible.
public static alphaNumeric ( string $check ) : boolean | ||
$check | string | The value to check. |
return | boolean | Success. |
/** * test the alphaNumeric method of IrValidation * * @return void */ public function testAlphaNumeric() { $this->assertTrue(IrValidation::alphaNumeric('آزمایش ۱۲۳۴۵۶۷۸۹۰')); $this->assertTrue(IrValidation::alphaNumeric('آزمایش 1234567890')); $this->assertTrue(IrValidation::alphaNumeric('هِمّت بُلَند دار کِه مَردانِ روزگار اَز همّتِ بُلَند به جایی رسیدهاَند')); $this->assertTrue(IrValidation::alphaNumeric('﷼')); $this->assertFalse(IrValidation::alphaNumeric('teststring')); $this->assertFalse(IrValidation::alphaNumeric('test1234567890')); $this->assertFalse(IrValidation::alphaNumeric('test آزمایش')); }