Domanda

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.

È stato utile?

Soluzione

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']);
?>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top