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


How to Install NordLayer VPN Client on Ubuntu 20.04 and Connect to a Virtual Network

A simple to follow installation guide for NordLayer VPN

MySQL usage, tweaks and learnings


Mastering MySQL Database Imports on Linux

Learn efficient ways to import MySQL databases on Linux using the mysql command-line client. Explore the --source option and < operator for seamless data migration. Master MySQL imports on Linux with our comprehensive guide.

DevOps principles and tool usage


Mastering SSH Key Conversions for DevOps

A guide to convert SSH keys from one version to another using Linux CLI