Unable to return session value in views Field I am storing a session value via Rules when the user is logged in 

session_start()
$_SESSION['userkey'] = "12345";


Also testing it below there

echo $_SESSION['userkey'];


Although when I am trying to retrieve this value in my view in a field as Global: PHP

with Value Code:

return $_SESSION['userkey'];


Output code:

&lt;?php
echo $value;
?&gt;


It does not return anything. Unsure whether the session is not being set properly or I am retrieving the value incorrectly?

Thanks.
You need to remove session_start() from Rules. Drupal calls session_start() when firing drupal_session_start().

Check out session_start manual on php.net


  As of PHP 4.3.3, calling session_start() after the session was
  previously started will result in an error of level E_NOTICE. Also,
  the second session start will simply be ignored. 


Screenshot for PHP field settings in Views: