#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2004
    Posts
    17
    Rep Power
    0

    Convert string to long int


    I am trying to use gmdate(), and need to convert a string to long int. But php shows strtol() as undefined function.

    Is this a version problem or how to do string to long int conversion?

    Thanks.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Jan 2004
    Posts
    1,014
    Rep Power
    788
    You can simply cast if there's no padding or extra text:
    PHP Code:
    $myInt = (int)$myString;

    Verify with the is_int($myInt) function.

IMN logo majestic logo threadwatch logo seochat tools logo