PHP ver gevorderde |
|
Zo kan het ook:
<?php
$_SESSION['ding'] = array();
$oldarray = array('ding1','ding2');
foreach($oldarray as $newarray)
{
$_SESSION['ding'][] = $newarray;
}
?>
<?php $_SESSION['ding'] = array(); $oldarray = array('ding1','ding2'); foreach($oldarray as $newarray) { $_SESSION['ding'][] = $newarray; } ?>
Output:
$_SESSION['ding'][0] = 'ding1';
$_SESSION['ding'][1] = 'ding2'; |