This line of code insures that the script will only be executed in the joomla system and prevents someone from access in the file directly
defined('_JEXEC') or die('Restricted access');
For our first example we will put out a simple line of html
<p>Hello, World</p>
The php file requires the minimum code as shown. code this on your php file
<?php
defined('_JEXEC') or die('Restricted access');
?>
<p>Hello, World</p>