News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Sean Coates' Blog:
Arbitrary Incrementer in PHP
August 06, 2010 @ 12:09:28

In a new post to his blog Sean Coates shares a technique he's used to pull an arbitrary incrementer from a certain set of characters.

On several recent occasions I had a need for an incrementer that uses an arbitrary character set and I thought I'd share my code with you. I've used this code in the GPL Virus that I wrote to poke fun at the Wordpress/Thesis/GPL debacle, as well as in some clean up I'm doing for the extremely useful JS Bin project.

He's used the technique in an upcoming URL shortening service to make the shortest possible URLs without overlap. He tried a few methods including using base_convert but they had their limitations. Ultimately, he settled on a custom function that, based on a given character set and increments over it recursively.

1 comment voice your opinion now!
arbitrary Incrementer baseconvert dechex example


blog comments powered by Disqus

Similar Posts

Luc de Brouwer's Blog: Stop waiting, start array dereferencing in PHP now!

MySQL Performance Blog: Integers in PHP, running with scissors, and portability

Matt Curry's Blog: HttpSocket Instead of cURL in CakePHP Apps

Leonid Mamchenkov's Blog: PHP regular expression to match English/Latin characters only

Matthew Weir O'Phinney's Blog: PHP globals for the OOP developer


Community Events

Don't see your event here?
Let us know!


introduction interview opinion library php7 api language unittest development framework video version release voicesoftheelephpant community laravel series example laravel5 podcast

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework