Full Breadcrums, how to?

Hi there, I’m trying to get a full breadcrumb in my theme, so it will be like this: Home > Parrent Category > Sub Category > Product.

Ive tried to make abit of a function but the the_category doesnt work, heres what ive made:

function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
echo "</a> » ";
if (is_category() || is_single()) {
if (is_single()) {
echo " » ";
} elseif (is_page()) {
echo the_title();

If any1 got a piece of code or can help me build my own that would be great. Cheers