Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

StarTutorial.com:
Understanding Design Patterns - Singleton
Apr 06, 2018 @ 11:28:50

The StarTutorial.com site has continued their introductory look at design patterns and using them in PHP with a new article covering the Singleton pattern.

[The Singleton pattern] ensures a class has only one instance, and provides a global point of access of it.

They use a more real-world example to illustrate the use of a singleton: organizing patients at a doctor's office using a ticketing system. In their example, the system makes use of a "TickerPrinter" object to represent the ticketing system. The issue is that the printer has to check every time to see if it needs more paper or if the ink is out in the first example. They refactor this to use a singleton, creating a getInstance method to return the same instance of a "TicketPrinter" object each time it's called rather than having to create a new one and manage it individually.

tagged: designpattern singleton introduction tutorial ticket printer

Link: https://www.startutorial.com/articles/view/understanding-design-patterns-singleton

Justin's Blog:
5 cool things you can do with windows and php
Apr 01, 2009 @ 07:57:01

Justin has posted a few cool things that you can do by combining PHP with someof the Windows functionality PHP has access to (either via direct function calls or through the COM object).

Many PHP examples out there are designed for a linux/unix operating system. I am going to give some examples of some interesting functionality that only works with php running in a windows environment (IIS or apache).

Hist list includes little things like ejecting the CD-ROM and sending things to the printer out to working with the registry and listing the current system processes.

tagged: cool windows cdrom registry system process printer

Link: