Jump to content

global object


Ra7or

Recommended Posts

Hi guys,

I try to use a global object.

require 'libs/smarty/Smarty.class.php';
global $smarty;
$smarty = new Smarty;

But its dos not work. I cant use the variable in functions. Asked google says that i have to use global $variablename. Or $GLOBALS['varialbe']; inside the function. OK, the problem is its isn't a variable, its a object. All thinks that i have done will not be. The only way that i know is: create the object again inside the function and again and again..... Thats sucks! Anyone know an other way?

 

Ra7or

 

Link to comment
https://forums.phpfreaks.com/topic/193355-global-object/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.