Function __global->geolocate_ip

Definitions

sources/locations.php

  • Find the country an IP address long is located in.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: string

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$ip ?IP No No Null N/A N/A The IP to geolocate (null: current user's IP)

Returns

  • The country initials (null: unknown)
  • Type: ?string
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Find the country an IP address long is located in.
 *
 * @param  ?IP $ip The IP to geolocate (null: current user's IP)
 * @return ?string The country initials (null: unknown)
 */

function geolocate_ip(?string $ip = null) : ?string