Previous Article

PHP Function to return your IP address

Next Article

Here's a quick little function which can be used to return your IP address

function getRemoteIPAddress() {
    $ip = $_SERVER['REMOTE_ADDR'];
    return $ip;

The result can be very handy when combined with an if statement to code parts of a site you don't want the end user to see. Just remember you need to know your IP address before you can create the statement below.

$ip = getRemoteIPAddress();

if ($ip == "insert your IP here") {
    //run the code only you want to see here
Avatar of Clive Walkden

Clive Walkden

Latest Articles

Linux command line tools, installations etc


Terraform Installation

A quick installation guide for Terraform on Ubuntu 18.04

Bitcoin - Cryptocurrency not just for geeks


RollerCoin Intro

An introduction to the RollerCoin site and how you can use it to mine your own coins

Magento 2 Blog Posts

Magento 2

Magento 2.4.x Writing to a Log File

How to log to information to a file in different Magento 2.4.x versions