Why doesn't this work?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • ScareCrowe

    #1

    Why doesn't this work?

    I am trying to format a date that is grabbed from a class that returns a
    timestamp. I can echo the variable and it prints correctly but if I pass it
    to the date function it doesn't. I figured out that the number is passed
    from the class as a string and not an integer. I thought I could just set
    the type to integer and it would work, but it doesn't. I'm a little confused
    because it really seems like I am saying the same thing both times but PHP
    disagrees. Is there something I am missing here?
    Thanks,
    --ScareCrowe

    Here is the script:
    <?
    $thistime=$abc->timeStats("Sta rtTime");// This would return '980126114' as a
    string, value is from remote XML parsed with eregi (just FYI)
    echo $thistime." => ".gettype($this time)."<br>\n"; //show the var type
    settype($thisti me, "integer");//change var to integer
    echo $thistime." => ".gettype($this time)."<br>\n";//show the var type
    ?>

    returns:

    980126114 => string
    0 => integer

    <?
    $thistime="9801 26114";// here the value is explicit
    echo $thistime." => ".gettype($this time)."<br>\n";//show the var type
    settype($thisti me, "integer");//change var to integer
    echo $thistime." => ".gettype($this time)."<br>\n";//show the var type
    ?>

    returns:

    980126114 => string
    980126114 => integer




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----
  • ScareCrowe

    #2
    Re: Why doesn't this work?

    Figured it out! Was returning array[0] instead of array[1] from the class,
    my dumbness!
    Thanks,

    --ScareCrowe




    -----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
    http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
    -----== Over 100,000 Newsgroups - 19 Different Servers! =-----

    Comment

    Working...