0
if var is declare in global so why can't use in function?
5 Answers
+ 2
yes, you can by defining it as global within function
for example:
<?php
$name = 'Ram';
function getName() {
global $name;
echo $name;
}
getName();
?>
0
As Rupali said you have to write global $variablename; before using a global variable.
0
way i am use in global
0
think each programing language has its own syntax
in c#,java you can but php does not allow that