This provides more information, as you can see if you do a var_dump() on the result:
function from_mysql_timestamp($timestamp)
{
list($year, $month, $day, $hour, $minute, $second) = preg_split("/\D/", $timestamp);
return getdate( mktime($hour, $minute, $second, $month, $day, $year) );
}
Or you could use MySQL's date and time functions:
http://dev.mysql.com/doc/mysql/en/date-and-time-functions.html
E.g.
SELECT YEAR( NOW() ) - YEAR(ts_column) FROM table;
(BTW, in your function, there's no need to make the return value a global variable.)
Jon Stephens
MySQL Documentation Team @ Oracle
Orlando, Florida, USA
MySQL Dev Zone
MySQL Server Documentation
Oracle