1,
"film"=>"",
"prix"=>0,
"dispo 14h"=>15,
"Total 14" =>0,
"dispo 17h"=>15,
"total 17" =>0,
"dispo 20h"=>15,
"Total 20" =>0,
"dispo 23h"=>15,
"Total 23" =>0
];
$detailsalle2=[
"numero de salle"=> 2,
"film"=>"",
"prix"=>0,
"dispo 14h"=>10,
"Total 14" =>0,
"dispo 17h"=>10,
"total 17" =>0,
"dispo 20h"=>10,
"Total 20" =>0,
"dispo 23h"=>10,
"Total 23" =>0
];
$detailsalle3=[
"numero de salle"=> 3,
"film"=>"",
"prix"=>0,
"dispo 14h"=>15,
"Total 14" =>0,
"dispo 17h"=>15,
"total 17" =>0,
"dispo 20h"=>15,
"Total 20" =>0,
"dispo 23h"=>15,
"Total 23" =>0
];
$detailsalle4=[
"numero de salle"=> 4,
"film"=>"",
"prix"=>0,
"dispo 14h"=>10,
"Total 14" =>0,
"dispo 17h"=>10,
"total 17" =>0,
"dispo 20h"=>10,
"Total 20" =>0,
"dispo 23h"=>10,
"Total 23" =>0
];
////////////////////////////////salle1////////////////////////////////////
// demande du film
(string)$choixfilm ="";
while(!$choixfilm):
print('bonjour homme du 7eme art, quel sera votre choix de film pour la salle 1'.PHP_EOL);
$choixfilm=trim(fgets(STDIN));
$detailsalle1["film"]=$choixfilm;
endwhile;
//////demande du prix
(int) $choixprix =0;
while(!$choixprix):
print('quel sera le prix du film pour la salle 1'.PHP_EOL);
$choixprix= intval(trim(fgets(STDIN)));
$detailsalle1["prix"]=$choixprix;
endwhile;
(int) $choixseance=0;
while($choixseance != 1 && $choixseance != 2):
print('Voulez vous rajouter une seance? oui(1) ou non(2)'.PHP_EOL);
$choixseance=intval(trim(fgets(STDIN)));
endwhile;
// demande si rajout seance
(string)$heureseance="";
if($choixseance == 1):
while(!$heureseance):
print('A quelle heure voulez vous programmer cette seance (xxh)'.PHP_EOL);
$heureseance=trim(fgets(STDIN));
$detailsalle1[]=["dispo $heureseance" =>15];
$detailsalle1[]=["total $heureseance" =>0];
endwhile;
elseif($choixseance = 2):
print('Que la fortune puisse vous sourire today'.PHP_EOL);
endif;
$Tabsalles[]=$detailsalle1;
print_r($detailsalle1);
////////////////////////////////////////salle2////////////////////////////////////////////
$choixfilm="";
$choixprix="";
(string)$choixfilm ="";
while(!$choixfilm):
print(' quel sera votre choix de film pour la salle 2'.PHP_EOL);
$choixfilm=trim(fgets(STDIN));
$detailsalle2["film"]=$choixfilm;
endwhile;
//////demande du prix
(int) $choixprix =0;
while(!$choixprix):
print('quel sera le prix du film pour la salle 2'.PHP_EOL);
$choixprix= intval(trim(fgets(STDIN)));
$detailsalle2["prix"]=$choixprix;
endwhile;
if($choixseance == 1):
while(!$heureseance):
print('A quelle heure voulez vous programmer cette seance (xxh)'.PHP_EOL);
$heureseance=trim(fgets(STDIN));
$detailsalle1[]=["dispo $heureseance" =>15];
$detailsalle1[]=["total $heureseance" =>0];
endwhile;
elseif($choixseance = 2):
print('Que la fortune puisse vous sourire today'.PHP_EOL);
endif;
$Tabsalles[]=$detailsalle2;
//////////////////////////////////salle3///////////////////////////////////
$choixfilm="";
$choixprix="";
(string)$choixfilm ="";
while(!$choixfilm):
print(' quel sera votre choix de film pour la salle 3'.PHP_EOL);
$choixfilm=trim(fgets(STDIN));
$detailsalle3["film"]=$choixfilm;
endwhile;
//////demande du prix
(int) $choixprix =0;
while(!$choixprix):
print('quel sera le prix du film pour la salle 3'.PHP_EOL);
$choixprix= intval(trim(fgets(STDIN)));
$detailsalle3["prix"]=$choixprix;
endwhile;
if($choixseance == 1):
while(!$heureseance):
print('A quelle heure voulez vous programmer cette seance (xxh)'.PHP_EOL);
$heureseance=trim(fgets(STDIN));
$detailsalle1[]=["dispo $heureseance" =>15];
$detailsalle1[]=["total $heureseance" =>0];
endwhile;
elseif($choixseance = 2):
print('Que la fortune puisse vous sourire today'.PHP_EOL);
endif;
$Tabsalles[]=$detailsalle3;
$choixfilm="";
$choixprix="";
//////////////////////////salle4///////////////////////////////////////////
(string)$choixfilm ="";
while(!$choixfilm):
print(' quel sera votre choix de film pour la salle 4'.PHP_EOL);
$choixfilm=trim(fgets(STDIN));
$detailsalle4["film"]=$choixfilm;
endwhile;
//////demande du prix
(int) $choixprix =0;
while(!$choixprix):
print('quel sera le prix du film pour la salle 4'.PHP_EOL);
$choixprix= intval(trim(fgets(STDIN)));
$detailsalle4["prix"]=$choixprix;
endwhile;
if($choixseance == 1):
while(!$heureseance):
print('A quelle heure voulez vous programmer cette seance (xxh)'.PHP_EOL);
$heureseance=trim(fgets(STDIN));
$detailsalle1[]=["dispo $heureseance" =>15];
$detailsalle1[]=["total $heureseance" =>0];
endwhile;
elseif($choixseance = 2):
print('Que la fortune puisse vous sourire today'.PHP_EOL);
endif;
$choixfilm="";
$choixprix="";
$Tabsalles[]=$detailsalle4;
///////////////////////menu film///////////////////////////////////
///////////////////////vente billet/////////////////////////////////
(int)$nbrtik=0;
while(!$nbrtik):
print('combien de billet voulez vous vendre'.PHP_EOL);
$nbrtik=intval(trim(fgets(STDIN)));
endwhile;
printf('les films du jour sont salle1 %s (1), salle2 %s (2), salle3 %s (3), salle4 %s (4)'.PHP_EOL,$detailsalle1["film"],$detailsalle2["film"],$detailsalle3["film"],$detailsalle4["film"]);
(int)$choixfilm=0;
while($choixfilm != 1 && $choixfilm != 2 && $choixfilm != 3 && $choixfilm != 4 ):
print('quel film desire voir le spectateur'.PHP_EOL);
$choixfilm=intval(trim(fgets(STDIN)));
endwhile;
(int)$choix=0;
(int)$dispo=0;
function nbrdeplaceDispo($nb1,$nb2){
return $nb1 - $nb2;
}
////////choix film//////////////////////////
if($choixfilm == 1):
//////////////choix seance//////////////////////////
while($choix!=1 && $choix!=2 && $choix!=3 && $choix!=4 ):
print(' a quelle seance? 14h(1),17h(2), 20h(3), 23h(4)'.PHP_EOL);
$choix=intval(trim(fgets(STDIN)));
switch($choix):
case($choix=1):
$detailsalle1["dispo 14h"]=$detailsalle1["dispo 14h"]-$nbrtik;
$dispo=nbrdeplaceDispo($detailsalle1["dispo 14h"],$detailsalle1["Total 14"]);
if($dispo>= $detailsalle1["dispo 14h"] ):
print('Il reste des places disponible, bon '.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 2):
$detailsalle1["dispo 17h"]=$detailsalle1["dispo 17h"]-$nbrtik;
$dispo=nbrdeplaceDispo($detailsalle1["dispo 17h"],$detailsalle1["Total 17"]);
if($dispo >= $detailsalle1["dispo 17h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 3):
$detailsalle1["dispo 20h"]=$detailsalle1["dispo 20h"]-$nbrtik;
$dispo=nbrdeplaceDispo($detailsalle1["dispo 20h"],$detailsalle1["Total 20"]);
if($dispo >= $detailsalle1["dispo 20h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 4):
$detailsalle1["dispo 23h"]=$detailsalle1["dispo 23h"]-$nbrtik;
$dispo=nbrdeplaceDispo($detailsalle1["dispo 23h"],$detailsalle1["Total 23"]);
if($dispo >= $detailsalle1["dispo 23h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
default:
print('plus de place a cette horaire'.PHP_EOL);
endswitch;
endwhile;
endif;
if($choixfilm == 2):
//////////////choix seance//////////////////////////
while($choix!=1 && $choix!=2 && $choix!=3 && $choix!=4 ):
print(' a quelle seance? 14h(1),17h(2), 20h(3), 23h(4)'.PHP_EOL);
$choix=intval(trim(fgets(STDIN)));
switch($choix):
case($choix=1):
$detailsalle2["dispo 14h"]=$detailsalle2["dispo 14h"]-$nbrtik;
$dispo=nbrdeplaceDispo($detailsalle2["dispo 14h"],$detailsalle2["Total 14"]);
if($dispo>= $detailsalle2["dispo 14h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 2):
$detailsalle2["dispo 17h"]=$detailsalle2["dispo 17h"]-$nbrtik;
$dispo=nbrdeplaceDispo($detailsalle2["dispo 17h"],$detailsalle2["Total 17"]);
if($dispo >= $detailsalle2["dispo 17h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 3):
$dispo=nbrdeplaceDispo($detailsalle2["dispo 20h"],$detailsalle2["Total 20"]);
if($dispo >= $detailsalle2["dispo 20h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 4):
$dispo=nbrdeplaceDispo($detailsalle2["dispo 23h"],$detailsalle2["Total 23"]);
if($dispo >= $detailsalle2["dispo 23h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
default:
print('plus de place a cette horaire'.PHP_EOL);
endswitch;
endwhile;
endif;
if($choixfilm == 3):
//////////////choix seance//////////////////////////
while($choix!=1 && $choix!=2 && $choix!=3 && $choix!=4 ):
print(' a quelle seance? 14h(1),17h(2), 20h(3), 23h(4)'.PHP_EOL);
$choix=intval(trim(fgets(STDIN)));
switch($choix):
case($choix=1):
$dispo=nbrdeplaceDispo($detailsalle3["dispo 14h"],$detailsalle3["Total 14"]);
if($dispo>= $detailsalle3["dispo 14h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 2):
$dispo=nbrdeplaceDispo($detailsalle3["dispo 17h"],$detailsalle3["Total 17"]);
if($dispo >= $detailsalle3["dispo 17h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 3):
$dispo=nbrdeplaceDispo($detailsalle3["dispo 20h"],$detailsalle3["Total 20"]);
if($dispo >= $detailsalle3["dispo 20h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 4):
$dispo=nbrdeplaceDispo($detailsalle3["dispo 23h"],$detailsalle3["Total 23"]);
if($dispo >= $detailsalle3["dispo 23h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
default:
print('plus de place a cette horaire'.PHP_EOL);
endswitch;
endwhile;
endif;
if($choixfilm == 4):
//////////////choix seance//////////////////////////
while($choix!=1 && $choix!=2 && $choix!=3 && $choix!=4 ):
print(' a quelle seance? 14h(1),17h(2), 20h(3), 23h(4)'.PHP_EOL);
$choix=intval(trim(fgets(STDIN)));
switch($choix):
case($choix=1):
$dispo=nbrdeplaceDispo($detailsalle4["dispo 14h"],$detailsalle4["Total 14"]);
if($dispo>= $detailsalle1["dispo 14h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 2):
$dispo=nbrdeplaceDispo($detailsalle4["dispo 17h"],$detailsalle4["Total 17"]);
if($dispo >= $detailsalle1["dispo 17h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 3):
$dispo=nbrdeplaceDispo($detailsalle4["dispo 20h"],$detailsalle4["Total 20"]);
if($dispo >= $detailsalle4["dispo 20h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
case($choix == 4):
$dispo=nbrdeplaceDispo($detailsalle4["dispo 23h"],$detailsalle4["Total 23"]);
if($dispo >= $detailsalle4["dispo 23h"] ):
print('Il reste des places disponible'.PHP_EOL);
else:
print('plus de place a cette horaire'.PHP_EOL);
endif;
break;
default:
print('plus de place a cette horaire'.PHP_EOL);
endswitch;
endwhile;
endif;