How to create a session? How to set a value in session?



How to create a session? How to set a value in session?..

Answer / Sameer Ahmad

To create a PHP session, you need to start the session using the `session_start()` function. To set a value in a session, use the `$_SESSION[]` array:

```php
session_start();
$_SESSION['my_variable'] = 'some value';
```

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

What is the difference between $message and $$message in php?

1 Answers  


Can i get free good material for preparation for Zend Certification can i get good questions about certification?

0 Answers  


Any good PHP developer looking for change

1 Answers  


Does empty check for null?

1 Answers  


What is the Diff. Between echo() and Print() in PHP?

29 Answers   CoreNet, Priya, QueenZend, Sky InfoTech, Syntel,


armstrong number by using php while number is given by the keyboard.?

1 Answers  


What is php's mysqli extension?

1 Answers  


What is the function to count elements in an array in PHP?

1 Answers  


How to list all values of submitted fields?

1 Answers  


How to remove leading and trailing spaces from user input values in php?

1 Answers  


Why does php need server?

1 Answers  


How to take a substring from a given string?

1 Answers  


Categories