Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

array session

<?php
$my_arr = array('Saumya', 'Nikita', 'Upasana', 'Dyana');
// use array_push to add 3 elements to end of $my_arr
$new_num = array_push($my_arr, 'Adhikar', 'sanjay', 'Puspendra', 'Mukesh');
// inspect return value of array_push
echo $new_num;
print_r($my_arr);
?>

//my ex

$id = $_GET['PId'];
                                // $cartArray = array(
                                  
                                // );
                               // array_push($cartArray, $id);
                                session_start();

                            // $_SESSION["cart"] = $cartArray;
                             $_SESSION['cart'][] = $id;

                             header("Content-type:application/json");
                             echo json_encode($_SESSION["cart"]);
Source by www.tutorialscan.com #
 
PREVIOUS NEXT
Tagged: #array #session
ADD COMMENT
Topic
Name
3+6 =