Re: how should MS Access DATETIME be handled in PHP?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> apparently $rec[0] is a php object - try the following lines to
> find out what's inside:
>
> echo '<pre>';
> print_r($rec[0]);
> echo '<pre>';
>
> that will probably give you a clue as to how to extract some
> useful info from the object.

Excellent!  Yes, it now does give me a clue to see what's actually in the
object.  print_r($rec[0]) shows:

stdClass Object ( [year] => 2005 [month] => 8 [day] => 31 [hour] => 0
[minute] => 0 [second] => 0 [fraction] => 0 )

I've never dealt with object in PHP.  Something new learnt today.  I'm now
able to use get_object_vars($rec[0]) to extract the info from the object. 
There is one thing I don't understand though.

Is there anything wrong with the follow code snippet?  The result of echo
is 'using list, year is" rather than 'using list, year is 2005'.

==
list($year,$month,$day,$hour,$minute,$second,$fraction) =
get_object_vars($rec[0]);
echo "using list, year is $year<br>";
==

This one works.  But I prefer using list.

==
$arr = get_object_vars($rec[0]);
echo "year is $arr[year]<br>";
==

Thanks,

Bing

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux