Display content depending on url parameter in PHP

//Replace the 'p' to any variable
<?php if (isset($_GET['p'])) { $variable = $_GET['p']; ?>
<?php if ($variable == 'test'): ?>
<!-- Put Content here -->
<p>This is just a test</p>
<?php endif; ?>
<?php };?>	

So by doing this, when you visit example.com?p=test, a paragraph texts “This is just a test” will appear on the page.