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 ...