Save a data of the global variable $ _SESSION in another variable

1

Good afternoon everyone. I have a question on how to obtain and save the values of $ _SESSION especially I just want an id that brings. I put these lines of code of how I see what you have:

$userLog = $_SESSION['usuario'];
dd($userLog); //Con esto se imprime todo lo que contiene el array

And this comes out:

I only want the number that has PK_USER, in this case the 82, but I do not know how to do it to save the value in a variable. What would be the form?

    
asked by Ivan92 18.12.2017 в 23:17
source

1 answer

0

Since your session variable is an associative matrix array you must access the data using the associative keys, try this:

$pk_usuario = $userLog['INFO_EMP']['PK_EMPLEADO'];

So you can access any particular data regardless of the dimensions of the array

    
answered by 18.12.2017 / 23:24
source