Posted by: Sourav | May 26, 2011

A reminder on functions in php


<html>
    <head>
        <title>
            Addition by function
        </title>
    </head>
    <body>
        <?php
        function calculation($val1,$val2)
        {
            $add=$val1+$val2;
            $sub=$val1-$val2;
           
           $result=array($add,$sub);
           return $result;
        }
       $result=calculation(8,6);
       echo “addition is” .$result[0].”<br />”;
       echo “subtraction is” .$result[1];
        ?>
       
       
       
    </body>
</html>

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: