March 18, 2003 | Category:

PHP Challenge #4

Welcome to another PHP challenge! This time we’re looking at something fundamental to all programming languages (for practical purposes: sorting. I want a script that takes in an array of strings and sorts it (the strings will probably be filenames without paths). The rules?

  • You must not use any of PHP’s predefined sorting functions,
  • It must be case-insensitive (“imagic – 1” and “ImAgic – 1” are the same thing) but preserve case structure in the returned array,
  • All scripts must return a sorted array and be named CISorter,
  • All functions submitted are considered public domain and hence can be reproduced and used with or without credit to anyone by anyone (so no bitching if someone rips off your script after the challenge finishes),
  • The winning script will be archived here for prosperity and to help others,
  • New rules may be added here at any time and my decision is final,
  • All functions should be submitted to solitude@vkps.co.uk,
  • The deadline for all entries is 12pm GMT on the 26th March 2003,
  • The winning script will be the one deemed the most efficient (mostly based on time efficiency but, if two entrants are close, spacial efficiency will be looked at.

Hope this one is challenging and can be reasonably done (unlike the last one). Good luck!