Test
Testunknown
php
4 years ago
1.0 kB
8
Indexable
<?php
include '../connect/config.php';
//Error Hendling
mysqli_error($link);
//JSON ENCODE DAN JSON DCODE
$arr = ["Panda", "Kelinci", "beruang"];
$arrMulti = [
[
"id" => 1,
"Nama" => "Alfasa",
],
[
"id" => 2,
"Nama" => "Alfasa",
],
[
"id" => 3,
"Nama" => "Alfasa",
],
[
"id" => 4,
"Nama" => "Alfasa",
]
,[
"id" => 5,
"Nama" => "Alfasa",
]
];
$jsons = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
//echo json_encode($arrMulti);
echo var_dump(json_decode($jsons, true));
//Cookie
//$cookie_name = "Halo Alfasa";
//setcookie($cookie_name, " Berhasil");
$values ="Halo";
setcookie("helloworld");
$_COOKIE['helloworld'] = $values;
$value = 'Halo Alfasa';
setcookie("TestCookie", $value);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>TEst</title>
</head>
<body>
<?php
echo $_COOKIE['helloworld'];
echo "<br>";
echo $_COOKIE["TestCookie"];
?>
</body>
</html>Editor is loading...