Today I want to explain how to use strategy design pattern in PHP. I tried to use this pattern when I want decouple algorithms for calculating something at runtime. For example, we can dynamically changing methods which will be calculate price of some items using some logic. Create car, for example: namespace strategy; abstract class Item{ abstract function getPrice(); } class Car extends Item{ protected $price; public $name; protected $isTuned; public function __construct($name, $price, $isTuned){ $this->name = $name; $this->price = $price; $this->isTuned = $isTuned; } /** * @return bool */ public function isTuned(){ return $this->isTuned; } public function getPrice(){ return $this->price; } } Suppose we want to separate method which will calculate price with different strategies. Create interface which will be implemented in each strategy. namespace strategy; int...