-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1.php
43 lines (39 loc) · 1.3 KB
/
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
<?php
//method/function untuk me-return biodata
function biodata(){
$name = "Aqil Gifari";
$address = "Ciamis, Jawa Barat, Indonesia";
$hobbies = ["ngoding","youtubing"] ;
$is_married = false;
$highSchool = "SMK Negeri 1 Kawali";
$university = "Belum";
$skill = ["js", "php", "java", "bootstrap","codeigniter"];
$score = ["80", "90", "85", "85", "85"];
return array(
"name" => $name,
"address" => $address,
"hobbies" => $hobbies,
"is_married" => $is_married,
"highSchool" => $highSchool,
"university" => $university,
"skill" => $skill,
"score" => $score
);
}
//memanggil function
$biodata = biodata();
$biodata_tojson = [
"name"=> $biodata['name'],
"address" => $biodata['address'],
"hobbies"=> $biodata['hobbies'],
"is_married"=> $biodata['is_married'],
"school"=> ["highSchool"=> $biodata['highSchool'],
"university"=> $biodata['university']],
"skills"=> ["name"=> $biodata['skill'],
"score"=> $biodata['score']],
];
//Return value ke format JSON
$data = json_encode($biodata_tojson);
echo $data;
//telah diuji di https://www.onlinegdb.com/
// 1.php by aqil gifari _ b10k3a