How does PHP use the global variable & lt ;? Phpglobal & nbsp; $ vfp_oledb_CString = "Provider = VFPOLEDB.1; Data & nbsp; Source = d:/testol PHP how to use global variables
global $vfp_oledb_CString;
$vfp_oledb_CString="Provider=VFPOLEDB.1;Data Source=d:/testoledb; Collating Sequence=MACHINE";
testgol();
function testgol(){
echo $vfp_oledb_CString;
}
The result is no output. how can I define and use global variables:
------ Solution --------------------
$ Vfp_oledb_CString = "Provider = VFPOLEDB.1; Data Source = d:/testoledb; Collating Sequence = MACHINE ";
Testgol ();
Function testgol (){
Global $ vfp_oledb_CString;
Echo $ vfp_oledb_CString;
}
------ Solution --------------------
You can also use $ GLOBAL to overwrite GLOBAL variables.
$ Vfp_oledb_CString = "Provider = VFPOLEDB.1; Data Source = d:/testoledb; Collating Sequence = MACHINE ";
Testgol ();
Function testgol (){
Echo $ GLOBALS ['vfp _ oledb_CString '];
}