1
class InputCheck
{
   const NOT_INPUT = "%sRequired";

   public function inList ($msg = null)
   {
     print_r(self::$msg);exit;
   }
}

(new InputCheck())->inList('NOT_INPUT');

In this class I have defined a constant with the name NOT_INPUT. One of the methods accepts a string which contains the name of that constant. How can I use this value to access the class constant dynamically?

Dharman
  • 30,962
  • 25
  • 85
  • 135
babu raj
  • 11
  • 5

0 Answers0