PHP face question design pattern, PHP test question design mode _php Tutorial

Source: Internet
Author: User

The design pattern of PHP test questions and the design pattern of PHP test questions


Design patterns are a question that will inevitably be asked during a technical interview, specifically giving you an example of how to use the various design patterns.

Using design patterns can reduce our workload and optimize our code.

The design pattern is very many, here introduces the singleton mode, the Factory mode, the combination mode, the Strategy mode 4 kinds of modes

/* * * single case mode *   */ class config{    staticprivate $_instance = NULL;     private $_settings = Array ();     Private function __construct () {}     Private function __clone () {};     Static function getinstance ()    {        if(self::$_intance = = NULL)            {new  Config ()        ;        } return self:$_intance;    }      Public Set ($index, $value)    {        $this->_setting[$index] = $value;    }       Public Get ($index)    {        return $this, _settings[$index];    }}

http://www.bkjia.com/PHPjc/1059919.html www.bkjia.com true http://www.bkjia.com/PHPjc/1059919.html techarticle The design pattern of PHP test questions, the design pattern of PHP test questions is a question that will inevitably be asked when technical interview, especially let you illustrate the use of various design patterns ...

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.