-
Notifications
You must be signed in to change notification settings - Fork 0
/
1.php
49 lines (45 loc) · 994 Bytes
/
1.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>soal 1</title>
<link rel="stylesheet" href="">
</head>
<body>
<?php
// definisi variabel
$name="Halim Hasanudin";
$address="Kp.Cikarokrok Rt. 01 Rw. 09 Ds. Sukasenang Kec. Banyuresmi Kab. Garut 44191";
$hobbies=array("membaca","nonton film");
$is_married=false;
$school=[
"highSchool"=>"SMKN 2 Garut",
"university"=>"Sekolah Tinggi Teknologi Garut",
];
$skills=[
["name"=>"HTML","score"=>5],
["name"=>"CSS","score"=>3],
["name"=>"PHP","score"=>4]
];
// gabungkan variabel dalam 1 array
$data=[
"name"=>$name,
"address"=>$address,
"hobbies"=>$hobbies,
"is_married"=>$is_married,
"school"=>$school,
"skills"=>$skills
];
// ubah array dalam bentuk json
$json = json_encode($data);
// buat fungsi biodata
function biodata($data){
// tampilkan data json
echo($data);
}
// panggil fungsi biodata
biodata($json);
?>
</body>
</html>