Problem with PHP string functions

I’m trying to muck around with some strings in PHP in my Wordpress theme. Can anyone imagine why this code wouldn’t work?

<?php $str = the_title(); $str = strtolower($str); $str = str_replace(" ","-", $str); echo $str; ?>I’m taking the page title, converting it to lower case, and replacing strings with hyphens. I haven’t tested with any pages with spaces yet. The page title is echoed, but it seems as if the strtolower function has not run on the string. Any help is greatly appreciated.

I think what I would do is rename each string variable then echo the variables to check the values. My guess it the_title() does not have a value or it is an array.

My website