
- You are not logged in. | Login
November 17, 2006 3:38 am
- bobbee
- Member


running the same code over and over
Hi! Thaks for the help on my other issue, now I've got another question.
Is there a way to run the same lines of code over and over without typing it or copying / pasting it over and over on my page?
November 17, 2006 6:45 pm
- phppat
- Member


Re: running the same code over and over
What you're looking for is called a function.
ex.
function my_function ( $var1, $var2 ) {
$sum = $var1 + $var2;
return ($sum)
};You can call it like this:
$a = 5; $b = 10; $the_sum = my_function ($a, $b) ## The sum = 15
PHP monster


