Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Linux, Apache, MySQL, PHP
  4. PHP 8.2 - Unsupported operand types: string * int

PHP 8.2 - Unsupported operand types: string * int

Scheduled Pinned Locked Moved Linux, Apache, MySQL, PHP
phphelp
3 Posts 3 Posters 15 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Aruna KN
    wrote on last edited by
    #1

    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

    L U 2 Replies Last reply
    0
    • A Aruna KN

      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

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      The error message suggests (because you have not provided all the information) that the variable $inactiv contains text data rather than an integral value.

      1 Reply Last reply
      0
      • A Aruna KN

        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

        U Offline
        U Offline
        User 10216595
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups