PHP Simple Calendar…

I have been looking for a proper, simple and well formed PHP calendar. I eventually found a promising looking script on emanueleferonato.com however it was not well formed (PHP or Output HTML)

I have tweaked the script to be correctly formed 😀 You can output any month of any year (within PHP restrictions) and you can start you week on any day of the week. i.e. Americans start on Saturday where as the English start on Monday.

Continue reading “PHP Simple Calendar…”

PHP Simple Calendar…

PHP Browser Detection…

Detecting the user’s browser type and version is helpful in web applications that harness some of the newer bleeding edge concepts. With the browser type and version you can notify users about challenges they may experience and suggest they upgrade before using such application. Not a great idea on a large scale public site; but on a private application this type of check can be helpful.

Searching for a way to do this at the PHP layer and not at the client layer was more of a challenge than I would have guessed; the only script available was written by Gary White and Gary no longer maintains this script because of reliability. I do agree 100% with Gary about the readability; however, there are realistic reasons to desire the user’s browser and browser version and if your visitor is not echoing a false user agent we can take an educated guess.

Check out the script and find out more information on the link below

http://chrisschuld.com/projects/browser-php-detecting-a-users-browser-from-php/

PHP Browser Detection…

PHP preg_match and Regular Expressions…

Regular expressions are a powerful tool for examining and modifying text. Regular expressions themselves, with a general pattern notation almost like a mini programming language, allow you to describe and parse text. They enable you to search for patterns within a string, extracting matches flexibly and precisely. However, you should note that because regular expressions are more powerful, they are also slower than the more basic string functions. You should only use regular expressions if you have a particular need.

This tutorial gives a brief overview of basic regular expression syntax and then considers the functions that PHP provides for working with regular expressions.

PHP supports two different types of regular expressions: POSIX-extended and Perl-Compatible Regular Expressions (PCRE). The PCRE functions are more powerful than the POSIX ones, and faster too, so we will concentrate on them.

Continue reading “PHP preg_match and Regular Expressions…”

PHP preg_match and Regular Expressions…