PHP 8.2 - Unsupported operand types: string * int
Linux, Apache, MySQL, PHP
3
Posts
3
Posters
15
Views
1
Watching
-
if (!isset($inactiv)) $inactiv = 0;
else $inactiv = my_time()-$inactiv*2592000;With PHP 8.2, code line 2 gives following error:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * int
Please suggest me a solution
-
if (!isset($inactiv)) $inactiv = 0;
else $inactiv = my_time()-$inactiv*2592000;With PHP 8.2, code line 2 gives following error:
PHP Fatal error: Uncaught TypeError: Unsupported operand types: string * int
Please suggest me a solution
Assuming $inactiv is an integer:
if (!isset($inactiv)) $inactiv = 0;
else $inactiv = my_time() - intval($inactiv) * 2592000;It will be better if you make sure the $inactiv is always a number