php - Please can anyone help explain to me the meaning of the following codes? -
please me understand following codes:
<?php session_start(); if(!isset($_session['staffid'])){ $_session['staffid']=""; } ?> does mean if there not set of staffid, set null?
it's checking see if key 'staffid' exists in $_session array.
for example, if have array:
$person = array( 'name' => 'george', 'age' => 22); then isset($person['name']) return true isset($person['height']) return false.
so code sample sets $_session['staffid'] '' (an empty string), if key has not been set yet $_session.
edit: it's worth noting if didn't know $_session variable special meaning in php, see docs.
Comments
Post a Comment