how to create a new function

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
kairya14
Forum Newbie
Posts: 3
Joined: Wed Mar 06, 2013 12:47 am

how to create a new function

Post by kairya14 »

hello all,
i am new in php development,and i do not know hohw to make any function an any one told me how i will do this?

thanks in advance
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: how to create a new function

Post by pbs »

uday.strad
Forum Newbie
Posts: 10
Joined: Wed Oct 02, 2013 1:03 am

Re: how to create a new function

Post by uday.strad »

LOL...
What sort of question is this .... you will always find this answer....although your new next time make sure you google these doubts....

Heres your answer....
<?php
function writeMsg()
{
echo "Hello world!";
}

writeMsg(); // call the function
?>
disha
Forum Newbie
Posts: 5
Joined: Fri Jul 18, 2014 6:21 am

Re: how to create a new function

Post by disha »

Hi,
You should try this code to call any function
<?php
function foo($arg_1, $arg_2, /* ..., */ $arg_n)
{
echo "Example function.\n";
return $retval;
}
?>

Thanks I hope it will help you.
Post Reply