<?php
function getCpanelUsername($label=''){
$parts = preg_replace('//+/', '/',$_SERVER["DOCUMENT_ROOT"]);
$path_parts = array_pad(explode('/', $parts),100,null);
if(is_int($label)){
return $path_parts[$label];
}else{
return $path_parts[2];
}
}
echo getCpanelUsername();
?>