Why doesn't this work?

From: ScareCrowe (nospam_at_nospam.com)
Date: 07/25/04


Date: Sat, 24 Jul 2004 22:49:45 -0500

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("StartTime");// This would return '980126114' as a
string, value is from remote XML parsed with eregi (just FYI)
echo $thistime." => ".gettype($thistime)."<br>\n"; //show the var type
settype($thistime, "integer");//change var to integer
echo $thistime." => ".gettype($thistime)."<br>\n";//show the var type
?>

returns:

980126114 => string
0 => integer

<?
$thistime="980126114";// here the value is explicit
echo $thistime." => ".gettype($thistime)."<br>\n";//show the var type
settype($thistime, "integer");//change var to integer
echo $thistime." => ".gettype($thistime)."<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! =-----



Relevant Pages

  • Re: its not the school home work
    ... I've learned a bit about strong quotes and think I realized when to ... the shell (such as in the $var, but also for the spaces (that ... echo "foo bar" ... you may say that $string does not appear in /list/ context so ...
    (comp.unix.shell)
  • Re: Calculate the string statement
    ... verkn:(vkn:char; ... funkt:(fkt:string; ... var fkt,dfkt: p; ... var fehler: boolean; ...
    (comp.lang.pascal.borland)
  • Re: test script
    ... echo $var> file1 ... When parsing a command bash sees "white space" (that is: ... literally in a string then you need to quote the string (or at ... While parsing your echo command bash first replaces $var with the ...
    (comp.os.linux.misc)
  • Re: test script
    ... echo $var> file1 ... literally in a string then you need to quote the string (or at ... While parsing your echo command bash first replaces $var with the ...
    (comp.os.linux.misc)
  • Two new tests for MM B&V
    ... var RunningThreads: Integer; ... class function TStringThreadTest.GetBenchmarkDescription: string; ... function CheckPattern(const Dest: Pointer; const Size: Integer; const ...
    (borland.public.delphi.language.basm)