[TYPO3-core] CGL, the global keyword

Jigal van Hemert jigal.van.hemert at typo3.org
Thu Oct 17 16:52:56 CEST 2013


On 16-10-2013 13:06, Christoph Dörfel wrote:
> Use of the global keyword is not recommended (not strictly forbidden
> though) according to the CGL.We should always use $GLOBALS['variable'].
> @see
> http://docs.typo3.org/TYPO3/CodingGuidelinesReference/PhpFileFormatting/PhpSyntaxFormatting/Index.html#global-variables
> Now to my question: Why is that? Does it have some serious drawbacks?

It's much easier to see global variables if the $GLOBALS array is used. 
With the global keyword the global variables look like local variables.

Jigal van Hemert
TYPO3 CMS Active Contributor

TYPO3 .... inspiring people to share!
Get involved: typo3.org

More information about the TYPO3-team-core mailing list