Ver originalsession_start(); // create an array $_SESSION['id'][]=$news_id; foreach ($_SESSION['id'] as $key => $value){ echo $_SESSION['id'][$key];}