Last active
May 20, 2020 06:18
-
-
Save bhavinrana07/cb4cacd3ff1417b2d69121bb42ff7a68 to your computer and use it in GitHub Desktop.
interface in php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
Interface MyInterface { | |
public function getName(); | |
public function getAge(); | |
} | |
class MyClass implements MyFirstInterface{ | |
public function getName() { | |
echo "My name A".'<br>'; | |
} | |
public function getAge(){ | |
echo "My Age 12"; | |
} | |
} | |
$obj = new MyClass; | |
$obj->getName(); | |
$obj->getAge(); | |
?> | |
OUTPUT: | |
My name A | |
My Age 12 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment