Last active
March 10, 2024 17:32
-
-
Save w3spi5/508a1087b523b4f78910429d4bdd78ef to your computer and use it in GitHub Desktop.
PHP - One line static function to check if you are in local or prod env
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
public static function isLocal(): bool | |
{ | |
return in_array($_SERVER['REMOTE_ADDR'], ['127.0.0.1', '::1']); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment