Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Replace people.json with your JSON File
- $jsonstr = file_get_contents("people.json");
- $jsonArray = json_decode($jsonstr, true);
- foreach($jsonArray as $record){
- $name = $record['name'];
- $address = $record['address'];
- $phone = $record['phone'];
- // Checking if query is the same.
- if ($query['name'] === $name && $query['address'] === $address){
- echo $phone;
- break;
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment