Is it less expensive to copy a multi-dim array from SESSION to a local variable, make changes (sometimes many) and then write the whole array back to SESSION, or is there no 'savings' and writing to SESSION constantly is just as good?
My one-page php program uses from from 3 to 10 dimensions deep which are foreach'ed as well as directly accessed.
I.E.: $_SESSION['undr'][$und]['vshft']['dsp'][$cp]['exp'][$exp]['mtxlnk']
My reasoning tells me (with very limited experience to draw upon) that SESSION info is saved in cookies which are on disk, so referring to disk for every sub-dim change is more expensive than copying a branch to a local variable, changing it, then when done, copying it back.
$vshft = $_SESSION['undr'][$und]['vshft'];
$vshft['dsp'][$cp]['exp'][$exp]['mtxlnk'] = 7;
$vshft['prn'][$cp]['tot'] = 4.332;
.
.
$_SESSION['undr'][$und]['vshft'] = $vshft;
I'm looking to minimize external impacts, so I take my oracle-query results and stuff them into arrays like this and _never_ re-query for the same thing (unless its dependencies have changed).
(Any comments on my never re-querying is appreciated as well.)
Thank you,
Will
My one-page php program uses from from 3 to 10 dimensions deep which are foreach'ed as well as directly accessed.
I.E.: $_SESSION['undr'][$und]['vshft']['dsp'][$cp]['exp'][$exp]['mtxlnk']
My reasoning tells me (with very limited experience to draw upon) that SESSION info is saved in cookies which are on disk, so referring to disk for every sub-dim change is more expensive than copying a branch to a local variable, changing it, then when done, copying it back.
$vshft = $_SESSION['undr'][$und]['vshft'];
$vshft['dsp'][$cp]['exp'][$exp]['mtxlnk'] = 7;
$vshft['prn'][$cp]['tot'] = 4.332;
.
.
$_SESSION['undr'][$und]['vshft'] = $vshft;
I'm looking to minimize external impacts, so I take my oracle-query results and stuff them into arrays like this and _never_ re-query for the same thing (unless its dependencies have changed).
(Any comments on my never re-querying is appreciated as well.)
Thank you,
Will