php session variable multidimensional associative array issue
associative-array, multidimensional-array, php, session-variables
Solution
Since I dont really know what other sorts of shenanigans the code is up to outside of this block you gave us I would say to just try this instead:
$_SESSION['resendConfirmation'] = array('id' => 8, 'function' => 'resend');
If this also fails then there has to be something else going on outside of what you posted. Good luck!
Problem
I've looked around SO, but can't find an explanation to what is going on in my $_SESSION variables. ``` @ob_start(); $k=@ob_get_contents(); @ob_end_clean(); @session_start(); unset($s,$m); $m1 = explode(" ", microtime()); $stime = $m1[1] + $m1[0]; echo $k; $_SESSION['resendConfirmation']['function'] = 'resend'; $_SESSION['resendConfirmation']['id'] = '8'; print_r($_SESSION); ``` outputs: ``` Array ( [resendConfirmation] => 8esend ) ``` Why is it string replacing? I've never had this issue before. What I want is thus: ``` Array([resendConfirmation] => Array( [id] =>8 [function} => resend ) ) ``` I've never had this happen before, I'm totally confused! UPDATE In response to @DanRedux I've changed to two non-existent variable names to take the referencing out of the equation, still the same result... ``` $_SESSION['resendConfirmation']['tweak'] = 'resend'; $_SESSION['resendConfirmation']['tweak2'] = '8'; ``` Same result :( Did a sitewide query of `resendConfirmation` and none were found, but once I change that array name, it all worked, baffled, but fixed... ``` $_SESSION['reConfirm']['function'] = 'resend'; $_SESSION['reConfirm']['id'] = '8'; print_r($_SESSION); ```