Web server software typically can be configured to look for a specific file or files in a directory to display to the browser if the browser isn't requesting a specific file from a directory. E.g., let's suppose your website is accessible via www.example.com. When the web server sees a request for www.example.com/a.txt, it will display the contents of a.txt. But, if it receives a request for just www.example.com, which is a request for the root directory for your website, the web server is likely configured to look for certain types of files, which may be index.html, index.php, and it seems in your case default.php. If it doesn't see them, it will show a listing of all the files in that directory, e.g., a.txt and b.txt, unless it is configured to not show such file listings, which is often the case for security reasons.
But, if index.php is in that directory, it will display the contents of that file. If you put some text in the index.php file, do you see it displayed? Below is a very simple page you could create using a PHP command to display "hello world".
<?php echo '<p>Hello World</p>'; ?>
If you upload that to your site, do you see "hello world" displayed? If not, there is likely a problem with PHP on your web server. You can also create a PHP file with just the line below in it and nothing else and upload it to your site. If PHP is working properly for your website, it should display the version of PHP installed on the web server as well as a lot of other information regarding PHP on the server. You can name the file testing.php or whatever you like. It wouldn't be a good idea to name it index.php and leave it in place for random people on the Internet to view that information, though, since it provides a lot of detail regarding the configuration of the web server used for your site.
<?php phpinfo(); ?>
If you don't see anything displayed, then PHP may not be installed on the server or may not be properly configured for use by your website.
If your purpose for putting the PHP file there is so that people can't see that you have a.txt and b.txt in that directory, then it does prevent them from seeing the list of files in the directory. However, if they know a.txt and b.txt are in that directory they can access them from www.example.com/a.txt, etc.
If you want to learn PHP, you can find tutorials online for free. E.g. PHP 5 Tutorial. You can also take online video courses for free at whatever time is convenient for you and at your own pace. Udemy offers free and relatively low-cost video courses that cover PHP. E.g. PHP & MySQL - PHP & MySQL for Beginners is free as is Beginner PHP and MySQL Tutorial. You can also take a free PHP course through Codecademy at PHP.