1. Home
  2. Computing & Technology
  3. PHP / MySQL

Session_start() PHP Function

By , About.com Guide

Definition: Session_start() is used in PHP to initiate a session on each PHP page. It must be the first thing sent to the browser, or it won't work properly, so it's usually best to place it right after the <?php tags. This must be on every page you intend to use sessions on. For more information read our sessions tutorial.
Also Known As: Start Session PHP
Examples:
<?php
// this starts the session
session_start();

// this sets variables in the session
$_SESSION['test']='testing';

print "Done";
?>
Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. PHP Session Start - Session Start Function - PHP Session Start Function

©2009 About.com, a part of The New York Times Company.

All rights reserved.