Cake\Localized\Validation\NlValidation::personId PHP Method

personId() public static method

Checks a social security number (BSN) for The Netherlands
public static personId ( string $check ) : boolean
$check string The value to check.
return boolean Success.
    public static function personId($check)
    {
        $pattern = '/\\A\\b[0-9]{9}\\b\\z/i';
        return (bool) preg_match($pattern, $check);
    }

Usage Example

Beispiel #1
0
 /**
  * test the ssn method of NlValidation
  *
  * @return void
  */
 public function testSsn()
 {
     $this->assertTrue(NlValidation::personId('187821321'));
     $this->assertTrue(NlValidation::personId('502222314'));
     $this->assertFalse(NlValidation::personId('18782132'));
     $this->assertFalse(NlValidation::personId('50222FZ'));
 }