note 59941 added to function.session-register

From: Date: Tue, 20 Dec 2005 19:41:30 +0000
Subject: note 59941 added to function.session-register
Groups: php.notes 
Request: Send a blank email to php-notes+get-100484@lists.php.net to get a copy of this message
It states above that there is no need to set $HTTP_SESSION_VARS or to use session_register if you are using >PHP4.1x but this is NOT the case! [dependant upon your system] Using PHP5 you can set a session variable like this: if(!session_id()) session_start(); $_SESSION['your_id']=$your_id; BUT, with PHP4 you need to use (also fine for PHP5): if(!session_id()) session_start(); session_register("your_id");//used for older versions of PHP $HTTP_SESSION_VARS['your_id']=$your_id;//used for older versions of PHP $_SESSION['your_id']=$your_id; //tested on PHP4 on Linux, FreeBSD and Windows. So if you are updating your scripts ready for use with PHP5 but still running on version 4 then use the later method. ---- Manual Page -- http://www.php.net/manual/en/function.session-register.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+59941 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+59941&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+59941&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#100484) next »