i have session code
it’s working fine
but some friend told me this code should not work !
but it’s work fine with me !
i try code on localhost
so my question is , if i uploaded this code to my server
it will work fine like localhost ?
or will not work like my friend said ?
my code is
session_start();
$_SESSION['news'][] = 'First';
$_SESSION['news'][] = 'Second';
print_r($_SESSION['news']);
its print
Array ( [0] => First [1] => Second )
and that’s what i want !
it’s fine ..
Yes it will work definitely.
Or to be more safe you can do like following before assigning it values.