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
  • 3,419
  • 7
  • 29
  • 29
Hkm Sadek
  • 2,558
  • 6
  • 37
  • 81

0 Answers0