Posted by: Sourav | May 26, 2011

Use of global in functions in php


<html>
    <head>
        <title>
            Use of global
        </title>
    </head>
   
    <body>
   
    <?php
   
   
    $sourav=”What’s up”;
   
    function test($value)
   {
    $value=”Now what”;
return($value);
   }

$sourav=test($sourav);
    echo $sourav.”<br />”;
   
   
    ?>
    <?php
   
   
    $sourav=”What’s up”;
   
    function test1()
   {
   
global $sourav;
$sourav=”Now what”;
   }

test1();
    echo $sourav;
   
   
    ?>
   
   
   
   
    </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: