Results 1 to 2 of 2
  1. #1
    Senior Member
    Join Date
    Jun 2016
    Posts
    196

    How to implement Interface in PHP ?

    Well I've resolved it by my self.
    <?php
    interface b
    {
    public void function abc();
    public void function xyz();
    }

    class Myclass implements b
    {
    //remember that after this you won't afford to not define anyone function mentioned in Interface
    //You may need to define both
    //you can define more functions other than you declare in Inferface

    var $a,$b;
    function __construct($aa,$bb)
    {
    $this->a=$aa;
    $this->b=$bb;
    }

    function abc()
    {
    return $this->a;
    }

    function xyz
    {
    return $this->b;
    }
    }

    $obj= new Myclass("Addison","Cave");
    $obj->abc();
    $obj->xyz();
    // but on time of crating objects it's not to use both functions

    ?>
    Last edited by addisoncave; 08-17-2016 at 07:58 AM.

  2. #2
    Registered User
    Join Date
    Jun 2016
    Posts
    62
    Item connections allow you to create rule which identifies which techniques a class must apply, without having to determine how these techniques are managed.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

  Find Web Hosting      
  Shared Web Hosting UNIX & Linux Web Hosting Windows Web Hosting Adult Web Hosting
  ASP ASP.NET Web Hosting Reseller Web Hosting VPS Web Hosting Managed Web Hosting
  Cloud Web Hosting Dedicated Server E-commerce Web Hosting Cheap Web Hosting


Premium Partners:


Visit forums.thewebhostbiz.com: to discuss the web hosting business, buy and sell websites and domain names, and discuss current web hosting tools and software.