Skip to content

Instantly share code, notes, and snippets.

@yostane
Last active February 18, 2021 13:47
Show Gist options
  • Select an option

  • Save yostane/8fb92e6001d03aa28386e92000eb2b22 to your computer and use it in GitHub Desktop.

Select an option

Save yostane/8fb92e6001d03aa28386e92000eb2b22 to your computer and use it in GitHub Desktop.
<?php
$reservation = Array("id" => 1, "date_debut" => "2021-02-21", "date_fin" => "2021-02-28", "id_client" => 1);
$json = json_encode($reservation);
echo $json;
<?php
header('Content-Type: application/json');
$reservation1 = Array("id" => 1, "date_debut" => "2021-02-21", "date_fin" => "2021-02-28", "id_client" => 1);
$reservation2 = Array("id" => 2, "date_debut" => "2021-03-01", "date_fin" => "2021-04-28", "id_client" => 3);
$reservations = Array($reservation1, $reservation2);
$json = json_encode($reservations);
echo $json;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment