You can also write your own as you have done with JavaScript functions. Create a page called phpfunctions.php from your PHP template.  Place the following code in the PHP block at the top:

function saySomething() {
	echo "<p>Hello</p>";
}

Save and upload to your server (unless you are using XAMPP or similar of course) but when you try the page nothing should happen.  A function is a chunk of code but the code is only used when you call the function later in your code. 

Add some text for a heading (you should already have an h1 element).  You should already have a PHP tag just under that so put the function name inside it making it look like this:

<?php
    saySomething();
?>

Try the page again after uploading.  You should see hello as a paragraph under your heading.

Of course it would be easier to just echo "hello" where you need it but with longer code it is useful to place it away from your HTML.  You can also make a function do different things by passing data to it.