What role does robots.txt play in controlling search engine indexing of PHP pages?

Robots.txt is a file that tells search engine crawlers which pages or files on a website should not be indexed. To prevent search engines from indexing PHP pages, you can use robots.txt to disallow access to these pages.

User-agent: *
Disallow: /*.php$