PHP

Entries from August 2008

Search

Twitter

    PHP Stuff

    Monday, August 25. 2008

    Data Filtering Using PHP's Filter Functions - Part one

    Filtering data. We all have to do it. Most, if not all of us, despise doing it. However, unbeknown to most are PHP's filter_* functions, that allow us to do all sorts of filtering and validation. Using PHP's filter_* functions, we can validate and sanitize data types, URLs, e-mail addresses, IP addresses, strip bad characters, and more, all with relative ease. This is part one of two, covering filter_var() and the different constants and flags that can be set.
    Continue reading "Data Filtering Using PHP's Filter Functions - Part one"

    Saturday, August 23. 2008

    Practical Uses for the PHP Tokenizer

    When PHP has to process a request, the engine goes through several passes of parsing until the code is expressed as a set of instructions that the interpreter can execute. The first such step is “lexical scanning”, which splits the code into smaller strings called “tokens”. The token is the smallest meaningful unit of your source code, and it can represent a reserved word (for, while, class, if, etc.), operator (+, -, *, /, && etc.), value literals (integers, floats, strings etc.) and other special symbols.

    The same lexical scanner which PHP uses, is also available to userspace PHP developers via the function token_get_all().

    Thursday, August 14. 2008

    Dynamically Creating Graphs and Charts with PHP and GDChart

    If you've been working with PHP for a while, you already know that the language makes dynamic image generation very simple: the GD extension and a few lines of PHP code are all you need to create a JPEG, GIF or PNG image from scratch. However, while this works remarkably well for simple tasks, it can become tedious and complicated if you need to generate more complex images, such as graphs and charts, at run-time.