How do I create PHP Functions()
Posted by webinfiniteMar 3
There are over 700 functions available in php and below I will show you how to create you own function. Functions all start with the word function(). Here are some things to remember
- name your functions based on what a function does
- { start your function
- put your code
- } end your function
- call your function
<?php function fullname($firstname){ // Start your function with an appropriate function name
// Put your code
$last_name = “Smith”;
$full_name= $first_name . ” ” . $last_name;
return $full_name;
} // end your function
<?PHP echo fullname(Joe); ?> //Calling this function will display Joe Smith
No comments