Page 1 of 1

Simple: Your suggestions for function parameters?

Posted: Thu May 08, 2008 9:57 am
by JAB Creations
I just do not recall ever utilizing functions in PHP though I absolutely love and use them in JavaScript all the time. I'm curious about what I can do with parameters in PHP that may be useful but that I can not do in JavaScript. Here are a couple working examples that I put together... Yeah kind of strange that I have not begun messing with functions until this point. :|

Code: Select all

function my_function($my_parameter1, $my_parameter2)
{
echo $my_parameter1.$my_parameter2;
}
my_function('h','i');

Code: Select all

$my_parameter1 = 'g';
$my_parameter2 = 'o';
function my_function($my_parameter1, $my_parameter2)
{
echo $my_parameter1.$my_parameter2;
}
my_function($my_parameter1,$my_parameter2

Re: Simple: Your suggestions for function parameters?

Posted: Thu May 08, 2008 10:37 am
by aceconcepts
I've always found functions really really useful. One example I can give is when you INSERT data into a database i.e. a new user.

Simply call a function that takes for example a username and password and process them - Nice :D .