Posts Tagged ‘coding’

Binary Code and Bitwise Operators (in PHP)

Sunday, April 6th, 2008

At it’s core, all of the information on your computer is made up of bits - or 0’s and 1’s. There’s quite a bit of interpretation that goes on between that basic binary code and the information as it is displayed on your screen.

However, you may find a time to work with data at the binary level in PHP (and many other programming languages). Here’s a quick guide to understanding binary numbers and the common operators for handling them.
(more…)

How to Work With Directories in PHP

Thursday, March 6th, 2008

PHP offers a number of different functions to work with the local directory structure. There are at least three fairly simple ways to create and output a list of files in a directory.

Like the file functions, each method is slightly different. Knowing how each operates will help you choose which function to use when you want to work with directories in your PHP script.
(more…)

Combinations: General Function to Get All Possible Combinations

Thursday, February 28th, 2008

Previously, we looked at how to calculate a binomial coefficient (to find the total number of possible combinations) and an example of how to generate a list of combinations with hard-coded loops.

A function would be much more useful to us if it was flexible - if it could generate a list of combinations for any size set of numbers. We can’t do this with the hard coded loop solution, so we need to come up with a better method.
(more…)