NYCPHP Meetup

NYPHP.org

[nycphp-talk] TRUE/FALSE and $_SESSION variables

Michael Southwell michael.southwell at nyphp.com
Wed Jul 11 22:50:12 EDT 2007


This tiny script:
<?php
session_start();
$ineligibleFlag = FALSE;
if ( $ineligibleFlag === FALSE ) echo 'it is false<br />';
$_SESSION['ineligibleFlag'] = FALSE;
print_r( $_SESSION );

produces this output:
it is false
Array ( [ineligibleFlag] => )

The docs tell me that sessions can handle everything that can be 
serialized, and that serialize can handle everything but resources, 
and that I shouldn't define resource constants.  But FALSE is not a 
resource that I know of, and so none of that explains (that I can 
see, anyway) why the session can't hold this value. I can easily work 
around this, but I'd like to understand it as well.

Michael Southwell, Vice President for Education
New York PHP
http://www.nyphp.com/training - In-depth PHP Training Courses





More information about the talk mailing list