abstract class example php

Example 1: php abstract class constant

abstract class Hello {
    const CONSTANT_1 = 'abstract'; // Make Abstract
    const CONSTANT_2 = 'abstract'; // Make Abstract
    const CONSTANT_3 = 'Hello World'; // Normal Constant
    function __construct() {
        Enforcer::__add(__CLASS__, get_called_class());
    }
}

Example 2: PHP OOP - Abstract Classes

<?php
abstract class 
    ParentClass {
  abstract public function someMethod1();
  
    abstract public function someMethod2($name, $color);
  abstract 
    public function someMethod3() : string;
}
?>

Tags:

Php Example