Jump to content

Very basic function() related problem !!!


rahul.pache

Recommended Posts

I am using XAMPP {PHP 5}

Here is the code :

 

 <?php
$var=0;
function test() {
echo "<br> VAr : " . $var;
$var = 1;
echo "<br> VAr : " . $var;
}
test();
if($var == 1) {
  echo "Hello";
}
?>

 

I have taken 1 variable $var = 0; outside the function

And I want to use it inside the function. So that after changing its value it will be available to print "hello"

 

Plz suggest how to do that.

I WILL BE VERY VERY THANKFULLLLLLL

Link to comment
https://forums.phpfreaks.com/topic/100452-very-basic-function-related-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.