Generating node title from node fields
I think it's better idea to use token instead of php code for this simple replacement.

When you have the token module installed you'll have a list with available tokens under the Pattern for the title: input box. And if your field is named *field_my_field* then you'll have the tokens

[field_my_field-formatted]
[field_my_field-raw]


or something like that to choose from.