PHP - SESSION multidimensional array - good or bad idea for performance?

Is there any reason not to want to use the SESSION multidimensional array to store temporary user data?

+3
source share
3 answers

I would say that it depends more on the size of the data, and not on the number of measurements, because the data is serialized before serialization. Of course, a deep multidimensional array can also lead to a performance hit, but this is a general indicator that there is a better way to do this.

+3
source

, , $_SESSION, . Session $_SESSION ['session']. - :

<?php
class Session
{
    private $something;

    public function Session()
    {
        // Constructory things
    }

    // Methods to your heart content
}

if (session_id() == '')
{
    session_start();
}

if (empty($_SESSION['session']))
{
    $_SESSION['session'] = new Session();
}
$session =& $_SESSION['session'];
?>

session.php, "session.php" php, , $session, .

+1

, .

.

-2

Source: https://habr.com/ru/post/1717353/


All Articles