Override Parent class variable to Static In child PHP

  oop, php

I have a parent class which has class variable called $subject, when I inherit my child class from it, I override the $subject, but I wanna convert it to static, I am getting following Cannot redeclare non static '$subject' as static $subject

Following is my snippet

class Message(){
   public $subject;
}

class SendMessage extends Message{
   public static $subject;

}

Source: Ask PHP

LEAVE A COMMENT