0

I am trying to make a small script that will load php files and then initiate classes automatically. I am trying to do it like this,

$className = ucfirst($folderName).'()';
\Elementor\Plugin::instance()->widgets_manager->register_widget_type( new \Elementor\$className );
//HERE I AM GETTING ERROR BECAUSE OF THE $class VARIABLE USED. 

The error I get:

Parse error: syntax error, unexpected '$className' (T_VARIABLE), expecting identifier (T_STRING)

How can I get ride of the error and initiate the class?

4

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.