Search Marketing

   
   

Creating and Using Functions

Fri May 02, 2008 10:03 pm
<<     >>
Comments: 0 Views: 241

Functions in PHP are very flexible.There are many built-in functions such as counting elements in an array, and connecting to MySQL, as well as many others.

1. Create a function for adding 5 to any number.

function Add_Five($num)

{

$x = $num + 5;

return($x);

}

2. Calling the function.

echo Add_Five(4);

answer: 9

3. Any number placed between the parentheses and echoed will result in 5 being added to that number.



Comments
Name:
*
URL: http: (ex. cnn.com)
Comment:
*
Number:
Math (21 + 3)
* required
SubCategories
Regular Expressions

© 2019 Christonium LLC

Christonium.com
|
Terms of Use
|
Privacy
ccc