Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa PHP creating a global variable with php

Have Programming Question? Ask it here!
 
 
 


Java Coder
creating a global variable with php
1 Answer(s)      2 years and 11 months ago
Posted in : PHP


Is it possible to create a variable to declare as global in case of database connectivity?


Advertisement
View Answers

September 17, 2011 at 12:22 PM


Yes, if you want to have access of that variable anywhere in the program. See the example below..

function processlogin($username, $password){
    global $database;
    $database->login($username, $password);
}


Related Tutorials/Questions & Answers:
Advertisements
 

 

 

DMCA.com