check for null or non interger value

Discussion in 'PHP' started by kalaid, Jul 16, 2007.

  1. #1
    Hi
    I know that below code checks for a NULL value but I also need to ensure that the value is not an integer or null value.How to check this?

    Code:

    if($Id == NULL || )
     
    kalaid, Jul 16, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    if($Id == NULL || gettype($id) != 'integer')
    
    PHP:
     
    nico_swd, Jul 16, 2007 IP
  3. kalaid

    kalaid Guest

    Messages:
    33
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Hi,
    Now it is working. Thank's for ur reply
     
    kalaid, Jul 16, 2007 IP
  4. powerspike

    powerspike Peon

    Messages:
    312
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #4


    
    if(strlen($id)>0 && !is_int($id))
    {
       // $id is not null, and it's not an int
    }
    
    
    Code (markup):
    that should do it
     
    powerspike, Jul 16, 2007 IP