Very basic function() related problem !!!
Posted: Thu Apr 10, 2008 4:23 am
I am using XAMPP {PHP 5}
Here is the code :
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 test and print "hello"
Plz suggest how to do that.
I WILL BE VERY VERY THANKFULLLLLLL
Here is the code :
Code: Select all
<?php
$var=0;
function test() {
echo "<br> VAr : " . $var;
$var = 1;
echo "<br> VAr : " . $var;
}
test();
if($var == 1) {
echo "Hello";
}
?>And I want to use it inside the function. So that after changing its value it will be available to test and print "hello"
Plz suggest how to do that.
I WILL BE VERY VERY THANKFULLLLLLL