PHP All Function Variables Global?

If you want to specifically use globals, take a look at $GLOBALS array. Even though there are couple of other ways Pass by reference Data Registry Object recommended etc.

If you want to specifically use globals, take a look at $GLOBALS array. Even though there are couple of other ways, Pass by reference, Data Registry Object recommended, etc. More on variable scopes.

You don't want it global. On alternative is to encapsulate it in a object or even use a DI in order to configure it.

Maybe you can return these variables from your init() function : function init(){ error_reporting(0); $time_start = microtime(true); $con = mysql_connect("localhost","user123","password123"); mysql_select_db("db123"); return array('time_start' => $time_start, 'con' => $con); }.

Thanks! If nobody posts a better answer Ill accept. – nebkat Jun 9 '10 at 15:53.

You can declare them in the global scope, then pass them to the function by reference. After modifying the function to do so.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions