- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
/**
* Validate natural number (0,1,2,3,...)
*
* @param string $value number
* @return string
*/
public function natural($value)
{
$response = '';
if (!preg_match('/^[0-9]+$/', $value)) {
$response = $this->lang->get_str('system_invalid_neutral');
}
return $response;
}
/**
* Validate natural number, but not a zero (1,2,3,...)
*
* @param string $value number
* @return string
*/
public function natural_no_zero($value)
{
$response = '';
if (!preg_match('/^[0-9]+$/', $value)) {
$response = $this->lang->get_str('system_invalid_neutral_no_zero');
}
if ($value == 0) {
$response = $this->lang->get_str('system_invalid_neutral_no_zero');
}
return $response;
}