Can someone please help me with the right code to do this.
Like in WHM/cPanel I need to take a domain name out of my database and create the username the will be the first 8 characters of the domain name.
e.g. thisismydomain.com would be thisismy
But if there is a dot (.) then the dote has to be taken out but still make up a 8 character username.
e.g. theabc.com would be theabcco
And at the same time if there isn't 8 characters it just uses the total amount there.
e.g. abc.com would be abccom
Thanks for any help.
Is this what you want? I presume you have access to cpanel DB and you have already retrieved the domain name.
$domain = 'thisismydomain.com'; // I presume you have access to cpanel DB and you have already retrieved the domain name
$username = substr(str_replace(".", "", $domain), 0, 8);
This topic is now closed. New replies are no longer allowed.