<?php

include ("..\jsondata3.php");
$arr = json_decode($jsonData3, TRUE);
//print_r($arr);

$record = array_filter($arr, function($rec) {
    //receiving parameter
    $id = $_GET['id'];
    if ($rec['id'] == $id) {
        echo json_encode(array( array('pid'=> $rec['pid'], 'id'=> $rec['pid'], 'jenama'=> $rec['jenama'], 'model'=> $rec['model'], 
                                        'kapasiti'=> $rec['kapasiti'], 'bateri'=> $rec['bateri'], 
                                        'input'=> $rec['input'], 'berat'=> $rec['berat'], 'saiz'=> $rec['saiz'], 'gambar'=> $rec['gambar'] 
                                        ) ));
        die();
    }
    //return $rec['id'] == $id;
});

//var_dump($record);
echo json_encode($record);

?>
