Most of joomla api return reference, such as:
In this example, the current date and time is retrieved and output in the current default locale format.
=========================
$date =& JFactory::getDate();
echo 'Current date and time is: ' . $date->toFormat() . "\n";
If the current language is English then this will output something like
Current date and time is: 2008-11-22 18:14:08
=========================
This is because the returned object will update the existing one, while not creating new global one, except the object not created yet.
As explained here, in api.joomla.org:
=========================
getApplication (line 34)
Get a application object
Returns a reference to the global JApplication object, only creating it if it doesn't already exist.
=========================
No comments:
Post a Comment