13693261870
2022-09-16 354b3dbfbffb3df45212a2a44dbbf48b4acc2594
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
<?php
$customers = array(array(
        'id'=>1,
        'name'=>'Bread Barn',
        'phone'=>'8436-365-256'
    ), array(
        'id'=>2,
        'name'=>'Icecream Island',
        'phone'=>'8452-389-719'
    ), array(
        'id'=>3,
        'name'=>'Pizza Palace',
        'phone'=>'9378-255-743'
    )
);
 
if (isset($_REQUEST['id'])) {
    $id = $_REQUEST['id'];
    foreach ($customers as &$customer) {
        if ($customer['id'] == $id) {
            echo json_encode($customer);
            break;
        }
    }
} else {
    echo json_encode($customers);
}
?>