0% found this document useful (0 votes)
81 views5 pages

php1 PDF

The document contains PHP code snippets demonstrating various PHP concepts like arrays, functions, sessions, and AJAX calls. It shows examples of declaring and manipulating arrays, defining functions that pass parameters by value and reference, using sessions to store shopping cart data, and making an AJAX GET request to return data from a PHP script.

Uploaded by

Ardjan Kabashi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
81 views5 pages

php1 PDF

The document contains PHP code snippets demonstrating various PHP concepts like arrays, functions, sessions, and AJAX calls. It shows examples of declaring and manipulating arrays, defining functions that pass parameters by value and reference, using sessions to store shopping cart data, and making an AJAX GET request to return data from a PHP script.

Uploaded by

Ardjan Kabashi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

<?

php

/*

$Bar = "a";

$Foo = "Bar";

$World = "Foo";

$Hello = "World";

$a = "Hello";

echo $$$$$$a;

echo $$$$$$$a;

*/

/*

$arr1 = [1,2,3];

$arr2 = array(0=>'1', 1=>2, 2=>3);

$equal = $arr1 == // vlera $arr2 ? "Equal" : "Not Equal";

$iden = $arr1 === // tipi(int,string etj) $arr2 ? "Identical" : "Not Identical";

echo "The arrays are [$equal] and [$iden]";

*/

/*

$array = array("A", 2 , "B", 3, 1);

$arrnum = array();

foreach ($array as $b)

if (is_numeric($b))

array_push($arrnum, $b);
//$arrnum = [2,3,4,];

function sorto($x, $y)

if($x==$y) return 0;

return $x<$y ? -1 : 1;

usort($arrnum, "sorto");

print_r($arrnum);

*/

/*

$data = "foo:*:1023:1000::/home/foo:/bin/sh";

list($user, $pass, $uid, $gid, $gencos, $home, $shell) = explode(":", $data);

echo $user. "+" . $uid;

*/

/*

$l = array('m', 'o', 'e');

$f = array('mobile', 'orange', 'f');

$text = 'm e';

$o = str_replace($l,$f,$text); // mobile e -- morangebile e

echo $o;

//echo str_replace("world", "hello", "Hello world");

// mobile e

// morangebile e
*/

/*

$a = 1;

$b = 2;

print "Value of a: " . $a . "<br>";

print "Value of b: " . $b . "<br>";

function pv($a, $b)

$a++; $b++;

print "Value of a: " . $a . "<br>";

print "Value of b: " . $b . "<br>";

pv($a, $b);//

print "Value of a: " . $a . "<br>"; // 2

print "Value of b: " . $b . "<br>";

// Passed by reference - Parametrat(Vlerat) mbeten te ndryshuara edhe jashte funksioni

// Passed by value - Parametrat(Vlerat) mbeten te ndryshuara vetem mbrenda funksioni

*/

$arr = array

array(1=>2, 2=>3),

array('a'=>5,'b'=>6)

);
$userID = 18656464;

$ProductId = 59821;

$sasia = 48;

$_SESSION['Shopping Cart'] = array();

$_SESSION['Shopping Cart'] = $userID;

$_SESSION['Shopping Cart'] = $ProductId;

$_SESSION['Shopping Cart'] = $sasia;

/*

$(document).ready(function()

$.ajax({

type: 'GET';

url: 'index.php';

data: 'id=Kodi';

success: function(result)

return result;

});

});

*/

//echo $ZIP[$_GET['Kodi']];

You might also like