Abstract class and Interface in PHP

Abstract class is class that can not be instantiated directly OR you can not create object of abstract class, always create object of child class.

1-Can not be instantiated
2-In Abstract class at least one method must be abstract

Example

<?php
//Declare abstract class using abstract keryword
abstract class absTest
{
        public function test()
        {
         return 1;
        }
}
$obj = new absTest();
//error
//Cannot instantiate abstract class absTest 
?>

Example : How to implement abstract classes in php

<?php
abstract class absTest
{
        abstract protected function myTest();

}
class childClass extends absTest
{
   //protected or public, but not private
   function myTest()
   {
   echo 1;
   }
}
$obj = new childClass();
$obj->myTest();
//output
// 1
?>

When inheriting a method in abstract class these methods must be defined with the same (or a less restricted) visibility in child class.In above example myTest method declare as protected,in the child class must be defined as either protected or public, but not private.

What is Abstract method and How to implement

Abstract method only be defined and declared in child class.Abstract method can create in abstract class or interface. In above example Methods(myTest) are defined as abstract,they declare only method's signature , they cannot define the implementation in abstract class.