<? | |
$id = $_SERVER['QUERY_STRING']; //$_GET[id]; | |
$json = '[ | |
{"title":"trench", "img":"https://i.imgur.com/HoPQJqI.jpg"}, | |
{"title":"coat"} | |
]'; | |
$mydata = json_decode($json); | |
foreach ($mydata as $v): | |
if ($v->title == $id) { | |
$item = $v->title; | |
break; | |
} | |
endforeach; | |
echo $item ? "<h2>$item</h2>" : '404'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment