PHP Multithreading – Faking It

August 20th, 2007

PHP doesn’t really support multi-threading per se but there are ways to do “fake” multithreading. Here’s one I saw in the PHPClasses.org newsletter – Multi-thread Simulation. Note that this class is intedend for use on a webserver, as opposed to running PHP scripts from a command line (or similar). Check the end of this post […]

Continue Reading...

How To Force File Download With PHP

August 12th, 2007

Say you want a PHP script that will make the browser to download a file instead of opening it. This is useful for common filetypes that would normally be displayed in a browser, like .html, images, PDFs and .doc files. You can find a lot of scripts that do this on the web but one […]

Continue Reading...

WordPress Killed My Code

August 2nd, 2007

…but that’s okay – WP-Syntax resurrected it. After looking at one of my earlier posts I noticed that all the backslashes were gone from my code examples, most notably my regular expressions. I had the code wrapped in <pre></pre> tags. As some searching revealed, this seems to be a recurrent bug in WordPress 2.2.1 (I […]

Continue Reading...

How To Check If Page Exists With CURL

August 2nd, 2007

Here’s a relatively simple PHP function that will check if an URL really leads to a valid page (as opposed to generating “404 Not Found” or some other kind of error). It uses the CURL library – if your server doesn’t have it installed, see “Alternatives” at the end of this post. This script may […]

Continue Reading...

How To Read/Write Icons With PHP

July 30th, 2007

I discovered this interesting PHP class today that can be used to process all kinds of .ico files in PHP. Features Read/write icon files. Extract individual icons from a multi-icon file as GD icon resources. Add new icons to an .ico file. Supports all icon image sizes, bit depths and transparency. You can find the […]

Continue Reading...