Cake\Localized\Validation\IdValidation::mobile PHP Method

mobile() public static method

Basic Check for Valid Mobile Mumbers for Indonesia.
public static mobile ( string $check ) : boolean
$check string The value to check.
return boolean Success.
    public static function mobile($check)
    {
        $pattern = '/(^0|^62|\\+62)(8[0-9]{8,10})$/';
        return (bool) preg_match($pattern, $check);
    }

Usage Example

Beispiel #1
0
 /**
  * Test the mobile method of IdValidation
  *
  * @return void
  */
 public function testMobile()
 {
     $this->assertTrue(IdValidation::mobile('08125985608'));
     $this->assertFalse(IdValidation::mobile('8125985608'));
 }