Question: I am trying to validate Item No.s from user input. If the plus symbol is placed at the first place then the is\_numeric function does not gives error but on placing the + symbol anywhere else it gives the error.

**Case 1 :** 

```
$ItemNumber = '+123456789';

if(!is_numeric($ItemNumber))
{
   echo 'Sorry! Invalid Item No. given.';
}
else
{
  echo 'Success';
}

 //Output : Success

```

**Case 2 :** 

```
$ItemNumber = '123456789+';

if(!is_numeric($ItemNumber))
{
   echo 'Sorry! Invalid Item No. given.';
}
else
{
  echo 'Success';
}

//Output : Sorry! Invalid Item No. given.

```

Answer: 
`'+123456789'` is valid numeric string.Check the manual [is\_numeric](http://php.net/manual/en/function.is-numeric.php), but `'123456789+'` is not
Use [ctype\_digit](http://php.net/ctype_digit) php function to get a valid number

```
$ItemNumber = '+123456789';
echo ctype_digit($ItemNumber);//false

$ItemNumber = '123456789+';
echo ctype_digit($ItemNumber);//false

$ItemNumber = '123456789';
echo ctype_digit($ItemNumber);//true

```