Php Functions are nice building blocks for your scripts to store needed processes or code to be used only as need by calling them into other scripts or files to run. They have the ability to pass variables by taking in the variable, doing something with it and then spitting it out as a finished process within your scripts see demos below:
echo 'Hello World';
echo 'Mr.Fred Flinstone 4213 Rock Ridge Road zip:000024';
$myvar='capitalize the first word in this string.';
function doVars($newvar)//converts $myvar to $newvar inside the function//
//execute both functions on same page or use include('path/function_file.php')on top of
//--the page where needed to call the functions//
//lets do one more//
$another='capitilize me !';
//Mr.Fred Flinstone 4213 Rock Ridge Road zip:000024
//Capitalize the first word in this string.
//Capitilize me !
//To Test this set of functions go here--> http://writecodeonline.com/php/