Yes, the PHP fillies are determined by its extension. IN the server that supports the PHP files see a file with the extension .php which means this file is a PHP file. PHP is an Interpreter based language. That means the PHP codes runs one line after another line. When a browser gets a PHP script it hands that file off to the PHP interpreter for the processing. The full process is done by the server.
So you must have to name your file with the extension .php