Hey,
I have this code, but currently it spits out everything in all caps, they told me to use ucwords to fix it but I have no idea how. Any coders out there willing to help for this quick fix? Thanks!
<?php
require_once('ip2location.class.php');
$ip = new ip2location;
$ip->open('ip2location/databases/IP-COUNTRY-REGION-CITY.BIN');
$record = $ip->getAll($_SERVER["REMOTE_ADDR"]);
echo ' Country Long: ' . $record->countryLong;
echo ' Region: ' . $record->region ;
echo ' City: ' . $record->city ;
?>
You want it to print contents with only the first letter uppercase and others lower, like "Washington" & "America" ?
Try this for example:
[PHP]
<?php
require_once('ip2location.class.php');
$ip = new ip2location;
$ip->open('ip2location/databases/IP-COUNTRY-REGION-CITY.BIN');
$record = $ip->getAll($_SERVER["REMOTE_ADDR"]);
$country = ucfirst(strtolower($record->countryLong));
$region = ucfirst(strtolower($record->region));
$city = ucfirst(strtolower($record->city));
echo ' Country Long: ' . $country;
echo ' Region: ' . $region;
echo ' City: ' . $city;
?>
[/PHP]
PERFECT! Thanks so much!
Cool, no problem bro!