0

I have a Login form with Array as a success result.

If User input right credentials, then the system will have output like this :

 Array ( [error] => false 
         [name] => admin 
         [email] => [email protected] 
         [apiKey] => e96d4538f1dea6b0bc16468e10191336 
         [status] =>actived 
         [createdAt] => 2014-11-08 16:31:14 ) 

How to save each array value into $_SESSION like this ?

$_SESSION['name'] = $Name;
$_SESSION['apiKey'] = $apiKey;

etc..

How to do it ?

What's the best approach? Thanks for any help :)

3
  • 1
    $_SESSION = array_merge($_SESSION, $yourArray); could work. Commented Nov 17, 2014 at 18:32
  • 4
    Keeping all these together as their related array in $_SESSION is probably wise. $_SESSION['login'] = $that_array; will group them under $_SESSION['login']['name'], $_SESSION['login']['apikey'] etc... Commented Nov 17, 2014 at 18:33
  • solved guys:) thanks for your help. sorry if my question is duplicate. I'm new here Commented Nov 17, 2014 at 18:44

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.