Question

Why does PHP not allow the use of a decimal value as a root key in $_SESSION?

For example...

$paper_num = '159339';
$mark = 'A';

$_SESSION[$paper_num][$mark];

... Doesn't work.

Was it helpful?

Solution

cant you save it in the session as an array eg..

<?php
session_start();
$paper_num = '159339';
$mark = 'A';

$paper_detail = array(
'paper_number'=> $paper_num,
'paper_mark'=> $mark);

$_SESSION['paper_details'] = $paper_detail;
print_r($_SESSION['paper_details']);
?>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top