Do you have this code in the .php file or in .html? It looks like this page (and php code) is interpreted as html. So, everything between opening <?php ... and $rand > is interpreted as html tag (thus not displaying), while content start with = 0
If this code is within .php file, you need to make sure php is installed and correct mime type is configured for .php files. If this code is within .html file, you can either rename it to .php or add handler for .html pages within this directory using .htaccess
.htaccess:
AddHandler application/x-httpd-php .html