I need to display some text based on the first letter of a domain name. EXAMPLE: If the first letter in the domain name is A, echo "The first letter is A." If the first letter in the domain name is B, echo "The first letter is B." If the first letter in the domain name is C, echo "The first letter is C." If the first letter in the domain name is D, echo "The first letter is D." RESULT: If the code is run on... apple.com/ the page would display, "The first letter is A." banana.org/fruit/yellow.html the page would display, "The first letter is B." coffee.info/ the page would display, "The first letter is C." drink.com/pepsi/ the page would display, "The first letter is D." This script will be run on many domains that point to the same folder (the folder where this script is located). Code examples would be very appreciated!
<?php $domainName=$_SERVER["SERVER_NAME"]; $firstLetter=substr($domainName,"0","1"); echo "First letter is ".$firstLetter; ?> PHP: