Archive for January, 2012
Custom Classes – Iterator + Container
This article covers making a custom iterator type container in PHP. When I talk about a “container” I mean a class that holds something, often in a similar was that an array does. Adding iterator capabilities to it means it will work with a foreach statement like an array does too, and once you complete [...]
Constants, and why they are used
In programming, a constant is anything that is supposed to be the same all the time and cannot be changed. Basically is is that way at least until the program starts again. In PHP constants are not similar to variables in syntax, which is in some ways a surprise. I’ll quickly show you a C [...]
Going Retro With PHP – A Hits Counter Step By Step
Going Retro With PHP – A Hits Counter Step By Step It wasn’t all that long ago that the web was littered with little “number of visitor” indicators. The point of these was either to show how popular your site was, or more likely just because the site owner had no administrator level site statistics [...]
Custom Math High and Low Functions in PHP
This should be a good beginner tutorial, especially if you have used some functions and if statements and haven’t gone much further. I will explain the concept as we go along, first let’s review the Ternary Operator / Operators that we will use. That is sort of a quick “what is the sign” test for [...]
PHP – What in the world is CType
Apparently the name comes from ctype.h, a file in the C programming language. The PHP engine can execute the code from that file in it’s ctype functions. Does the c in ctype stand for classification, or character maybe? I don’t know, but according to PHP, these functions “are always preferred over regular expressions, and even [...]
Let Your Users Log In
Something everyone should do once ( or several times ) when learning PHP is create a simple user and log in system. It is the basis of many different types of web sites, forums, WordPress sites, ebay, even search engines (Google) let you log in to customize your experience and access advanced features. Let’s stick [...]
Unlimited Arguments
If you’ve used printf/sprintf/etc. in PHP you may be wondering how these functions can accept any number of arguments and still make sense of it. You also may wonder how you can make functions that employ this ‘trick’. Well it’s not a trick really, it seems to be built in to every function the user [...]
In PHP gzcompress is easy, and often useful
xÅ“KLJNIMK Û½ That is what I got when I ran the following code: In the title I said “often useful”. If you look closely you’ll see why. The compressed version takes more bytes than the uncompressed. It’s not a surprise of course, the feature was created for compressing a file or something of considerable size, [...]