Created
April 26, 2019 12:09
-
-
Save ChristianOellers/4f62974b71d31cf49ab6eb8a09b0a51e to your computer and use it in GitHub Desktop.
Contao CMS - Get global variables by type - Prevent memory allocation error - Workaround
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Return parts of the $GLOBALS array sorted by type. | |
* It's recommended to not return all at once as this might run out of memory. | |
*/ | |
foreach (array_keys($GLOBALS) as $key) { | |
switch (gettype($GLOBALS[$key])) { | |
case 'array': { | |
debug(array_keys($GLOBALS[$key])); | |
break; | |
} | |
case 'object': { | |
debug(get_class_methods($GLOBALS[$key])); | |
break; | |
} | |
default: { | |
debug($GLOBALS[$key]); | |
break; | |
} | |
} | |
} | |
function debug ($value) { | |
// Add own debugging methods here | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment