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

StackOverflow https://stackoverflow.com/questions/18545758

  •  26-06-2022
  •  | 
  •  

Вопрос

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.

Это было полезно?

Решение

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']);
?>
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top