Created
July 30, 2013 10:07
-
-
Save whisher/6111760 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$recipes = array( | |
array( | |
'id'=> 1, | |
'title'=>'Cookies1', | |
'description'=>'Delicious1, crisp on the outside, chewy 1', | |
'ingredients'=> array( | |
'amount'=> '1', | |
'amountUnits'=> 'packet', | |
'ingredientName'=> 'Chips Ahoy' | |
), | |
'instructions'=> '1.1 Go buy a packet of Chips Ahoy' | |
), | |
array( | |
'id'=> 2, | |
'title'=>'Cookies2', | |
'description'=>'Delicious2, crisp on the outside, chewy 1', | |
'ingredients'=> array( | |
'amount'=> '1', | |
'amountUnits'=> 'packet', | |
'ingredientName'=> 'Chips Ahoy' | |
), | |
'instructions'=> '2.1 Go buy a packet of Chips Ahoy' | |
), | |
array( | |
'id'=> 3, | |
'title'=>'Cookies3', | |
'description'=>'Delicious1, crisp on the outside, chewy 1', | |
'ingredients'=> array( | |
'amount'=> '1', | |
'amountUnits'=> 'packet', | |
'ingredientName'=> 'Chips Ahoy' | |
), | |
'instructions'=> '3.1 Go buy a packet of Chips Ahoy' | |
), | |
); | |
if(isset($_GET['id'])){ | |
foreach($recipes as $recipe){ | |
if($recipe['id'] == $_GET['id']){ | |
$recipes = array($recipe); | |
break; | |
} | |
} | |
} | |
echo json_encode($recipes); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment