Create a file within your 'htdocs/' directory that ends in .php and the web server will understand it needs to be processed by the PHP interpreter.
Provide syntactically valid PHP code inside of <?php … ?> blocks and your code will automatically work. Try it out. Create a file named 'test.php' and enter the following text:
<?php echo "Hello world!"; ?>
Load it in your web browser. You can learn PHP for free at www.w3schools.com/PHP, a great way to immerse yourself in the basics of PHP, a language with many capabilities.