- preg_replace: documentation ( source)
- strtolower: documentation ( source)
<?php
function create_path($hash)
{
return preg_replace('#\w\K((?<=\w{5}).+)?#', '/', strtolower($hash));
}
// will output something like "a/h/q/6/d/"
echo create_path('aHq6dc93d7b');