How can php be used to return data from custom fields in a post?

If you want to use php inside the Post Content editing interface, it will not work (for security reasons), unless you install a plugin that allows it.

If you mean that the php would be put in the template file, then you can use the functions the_meta();(doc) and the more flexible get_post_meta($post_id, $key, $single);.