I know you can do this with many types of code but i havent fond how to with php.
Can you.
Something like this.
function main()
{echo "This is main function";}
is it posabel to do function name(){code}
Started by kcd, Nov 17 2005 09:27 AM
4 replies to this topic
#1
Posted 17 November 2005 - 09:27 AM
#2
Posted 17 November 2005 - 11:45 AM
Do you mean write your own functions? yes it's possible
You enter the code pretty much as you have and then call the function as you would with any other:
To avoid problems, make sure your function's name is not the same as that of a function built in to php
You enter the code pretty much as you have and then call the function as you would with any other:
function main()
{
echo "This is main function";
}
main();
To avoid problems, make sure your function's name is not the same as that of a function built in to php
#3
Posted 17 November 2005 - 11:48 AM
It dont work for me this is for php.
""Sorry my bad i gess it dose work tx i never knew""
""Sorry my bad i gess it dose work tx i never knew""
Edited by kcd, 17 November 2005 - 11:51 AM.
#4
Posted 19 November 2005 - 07:16 PM
That wont work you will have to use
or
function main() {
return "This is A Main Function";
}
echo main(); or
function shout(shout) {
return shout;
}
echo shout("Hello World!");
#5
Posted 19 November 2005 - 08:07 PM
Actually, it will work just fine. What won't work is your second piece of code due to the fact that you never used $'s for your variables.
If you don't believe me, try for your self, or read what php.net has to say
http://php.net/manua...e.functions.php
If you don't believe me, try for your self, or read what php.net has to say
http://php.net/manua...e.functions.php
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users
