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?

Caconde
  • 4,177
  • 7
  • 35
  • 32
Hkm Sadek
  • 2,987
  • 9
  • 43
  • 95

0 Answers0