Sudarshan Taparia Sudarshan Taparia - 7 months ago 10
PHP Question

PHP :Initializing elements of session array

I have created a session array as

$_SESSION[yans]=array();


I wish to initialize first 5 elements of this to 0.How it can be done?

Answer

As every on suggested above, try this:-

<?php
session_start();


$_SESSION['yans'] = array('A','B','C','D','E');
echo "<pre/>";print_r($_SESSION);die;

?>

Output:- http://prntscr.com/7btkxv

Note:- it's a simple example given for your understanding. thanks.

Comments