public static function mobile($check) { $pattern = '/^[- .\\(\\)]?((98)|(\\+98)|(0098)|0){1}[- .\\(\\)]{0,3}((90)|(91)|(92)|(93)){1}[0-9]{8}$/'; return (bool) preg_match($pattern, $check); }
/** * test the mobile method of IrValidation * * @return void */ public function testMobile() { $this->assertTrue(IrValidation::mobile('989123334444')); $this->assertTrue(IrValidation::mobile('00989353334444')); $this->assertTrue(IrValidation::mobile('+989363334444')); $this->assertTrue(IrValidation::mobile('+98 9373334444')); $this->assertTrue(IrValidation::mobile('(+98) 9383334444')); $this->assertTrue(IrValidation::mobile('+98-9323334444')); $this->assertTrue(IrValidation::mobile('+989203334444')); $this->assertFalse(IrValidation::mobile('teststring')); $this->assertFalse(IrValidation::mobile('999123334444')); $this->assertFalse(IrValidation::mobile('+999353334444')); $this->assertFalse(IrValidation::mobile('00999363334444')); $this->assertFalse(IrValidation::mobile('000989373334444')); $this->assertFalse(IrValidation::mobile('+00989383334444')); $this->assertFalse(IrValidation::mobile('+0989323334444')); }