There is no way to put PHP code on the thankyou screen itself because it is generated via a CGI and the webserver will not parse the CGI output for PHP code.
However if you have ShopSite Pro and you can use JavaScript for your purposes instead, you can use the Shopping Cart JavaScript Variables available in Pro, see the documentation at:
http://www.shopsite.com/help/9.0/en-US/sc/pro/cart.variables.html
Or if you have Pro and have access to your ShopSite shopping cart cgi directory and can write a commandline PHP script that would be executed by the thankyou.cgi when an order is completed, see the Order API documentation for variables that can be provided to your commandline scripts:
http://www.shopsite.com/help/9.0/en-US/sc/pro/order.api.html
-Loren