Since you are trying it on your computer do you have a server and PHP installed on your computer? PHP is an interpreted language and needs the PHP on the machine trying to run the code. "<?php" tells the interpreter that it is supposed to run the following code up until "?>". Trying to run PHP files without a server and PHP installed means there's nothing that knows that it is supposed to run your code.
You can either sign up for an account on a free server host that supports PHP (which will be most of them these days) or you can install something like WAMP Server (if you run Windows on a PC). WAMP is free software which runs a server, PHP and MySQL and will allow you to test all of your PHP from your own computer.