]>
Commit | Line | Data |
---|---|---|
947f0963 TL |
1 | <?php |
2 | $customers = array(array( | |
3 | 'id'=>1, | |
4 | 'name'=>'Bread Barn', | |
5 | 'phone'=>'8436-365-256' | |
6 | ), array( | |
7 | 'id'=>2, | |
8 | 'name'=>'Icecream Island', | |
9 | 'phone'=>'8452-389-719' | |
10 | ), array( | |
11 | 'id'=>3, | |
12 | 'name'=>'Pizza Palace', | |
13 | 'phone'=>'9378-255-743' | |
14 | ) | |
15 | ); | |
16 | ||
17 | if (isset($_REQUEST['id'])) { | |
18 | $id = $_REQUEST['id']; | |
19 | foreach ($customers as &$customer) { | |
20 | if ($customer['id'] == $id) { | |
21 | echo json_encode($customer); | |
22 | break; | |
23 | } | |
24 | } | |
25 | } else { | |
26 | echo json_encode($customers); | |
27 | } | |
6527f429 | 28 | ?> |