The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
Thanks
Try: http://registration.freeola.net/php/manual.html then, as Freeola have downloaded the PHP Manual, though it's not the clearest way to learn.
I found a book to be better, PHP 4 Teach yourself in 24 Hours was what did it for me :o).
function HelloWorld() {
echo "Hello world";
}
function coffee($name, $coffee) {
// call like any other program, eg coffee("Bob", "mocha");
echo "$name's favourite coffee is $coffee";
}
function coffee($name="Bob", $coffee="mocha") {
// sets default values, so $name contains "Bob" and $coffee contains
// "mocha", unless you define them otherwise
echo "$name's favourite coffee is $coffee";
}
?>
Of course, there's always someone who explains it better. In this case, it's the guy that wrote the manual:
http://www.php.net/manual/en/functions.php#functions.user-defined
;)
function MyFirstFunction() {
print "Hello Wolrd\n";
}
MyFirstFunction();
?>
===========================================
Thats how a function would look, although you would usually have more code within it to execute.
Is this the kind of example you were after??? If not, sorry, but come back and I'll try again :o).