<?php
$a ="helllo welcome to php! ....:)";
function msg(){
/* global $a; */
echo $a;
}
msg();
?>
Global variable $a is not accessible inside the function msg() but when i use global $a
then it is accessible, i want to know that it is accessible or not
without using global keyword inside or outside the function for the
particular variable
>Solution :
Why did you commented global $a
?
<?php
$a ="helllo welcome to php! ....:)";
function msg(){
global $a;
echo $a;
}
msg();
?>