Function __global->is_local_machine

Definitions

sources/global3.php

  • Find whether a machine is local (localhost or on non-routable LAN), rather than a live-site.Also see is_our_server().
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: bool

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$ip_or_hostname ?IP No No Null N/A N/A IP address or hostname (null: currently requested hostname)

Returns

  • If it is running locally
  • Type: boolean
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Find whether a machine is local (localhost or on non-routable LAN), rather than a live-site.Also see is_our_server().
 *
 * @param  ?IP $ip_or_hostname IP address or hostname (null: currently requested hostname)
 * @return boolean If it is running locally
 */

function is_local_machine(?string $ip_or_hostname = null) : bool