Le langage PHP
« On le retrouve dans un site web côté serveur »

<?php
$id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
$contents = file_get_contents("data.json");
$json = json_decode($contents);
$result = null;
foreach($json as $idx => $obj) {
if($obj->id == $id) {
$result = $json[$idx];
break;
}
}
if(!$result) throw new Exception("Could not find element");<?php
$id = filter_input(INPUT_GET, "id", FILTER_VALIDATE_INT);
$contents = file_get_contents("data.json");
$json = json_decode($contents);
$result = null;
foreach($json as $idx => $obj) {
if($obj->id == $id) {
$result = $json[$idx];
break;
}
}
if(!$result) throw new Exception("Could not find element");Si nous avons réussi à piquer votre curiosité et que vous souhaitez découvrir d'autres fiches thématiques :