PHP subst() function?

c2_91

New member
Using this string:
" mary jones lives in santa cruz, california at 22 ocean drive."

I need to use the subst() function to print "santa cruz, california" making the first letter of each word capitalized.

Here is what i used:
echo substr ( " mary jones lives in santa cruz, california at 22 ocean drive.\n",21,-1 );

It doesnt work quite right, i cant get it to cut off at the "a" in "california"
and how do i get the capital letters?
 
<?php

echo ucwords(substr ( " mary jones lives in santa cruz, california at 22 ocean drive.\n",21,22 ));


?>
 
Back
Top