Answer the question
In order to leave comments, you need to log in
How to access class method in $GLOBALS array?
Hello! Can you please tell me how to properly access the class method in the $GLOBALS array? My code throws an error:
Fatal error: Uncaught Error: Class "My\Icon" not found in /www/tpl.php...
use My\Icon;
$GLOBALS['messengers'] = [
[
'title' => 'Telegram',
'icon' => Icon::SVG( 'telegram' ),
]
//...
];
namespace My;
class Icon {
protected static array $icons = [
'telegram' => '<svg>...</svg>'
];
//...
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question