-2
<?php
    $userAgent = strtolower($_SERVER["HTTP_USER_AGENT"]);
?>

PHP Warning: Undefined array key "HTTP_USER_AGENT" in C:\Apache24\htdocs\info.php on line 2

I don't know why the error pops up. please teach me how to solve

  • 2
    Try `$userAgent = strtolower($_SERVER["HTTP_USER_AGENT"] ?? "");`. It is quite normal for `$_SERVER` keys to be missing when there's no content to report. – KIKO Software May 09 '22 at 10:53

0 Answers0