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 | |
$indianaDistrib = [ | |
"Indianna Jones et le Royaume du crane" => ["Harrison Ford", "Cate Blanchet", "Karen Allen"], | |
"Indiana Jones et la Dernière Croisade" => ["Harrison Ford", "Sean Connery", "Denholm Elliott"], | |
"Indiana Jones et le Temple maudit" => ["Harrison Ford", "Kate Capshaw", "Jonathan Ke Quan"] | |
]; | |
foreach($indianaDistrib as $movie => $distrib) | |
{ | |
echo "Dans le film $movie, les principaux acteurs sont :"; |
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 | |
$weapons = ['fists', 'whip', 'gun']; | |
$opponentWeapon = $weapons[rand(0,2)]; // Cela permet de choisir une arme de manière aléatoire. | |
$bestWeapon = ''; | |
if ($opponentWeapon == 'gun'){ | |
$bestWeapon = 'whip'; |
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 | |
function writeSecretSentence(string $PARAMETRE_1 , string $PARAMETRE_2 ):string | |
{ | |
$sentence = "$PARAMETRE_1 s'incline face à $PARAMETRE_2"; | |
return $sentence; | |
} | |
echo writeSecretSentence("La lune", "Le feu"); |
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 | |
class Personne | |
{ | |
public $name; | |
public $lastName; | |
public $address; | |
public $birthday; | |
public $allInformation = []; |
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
Récupère tous les champs pour les sorciers nés entre 1975 et 1985 : | |
SELECT * FROM wizard WHERE is_muggle = 0 AND birthdate BETWEEN '1975-01-01' AND '1985-01-01' | |
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| id | firstname | lastname | birthdate | birth_place | biography | is_muggle | | |
+----+-----------+----------+------------+-------------+---------------------------------------+-----------+ | |
| 1 | harry | potter | 1980-07-31 | london | | 0 | | |
| 2 | hermione | granger | 1979-09-19 | | Friend of Harry Potter | 0 | | |
| 4 | ron | weasley | 1980-03-01 | | Best friend of Harry | 0 | | |
| 5 | ginny | weasley | 1981-08-11 | | Sister of Ron and girlfriend of Harry | 0 | | |
| 6 | fred | weasley | 1978-04-01 | | |
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
Enregistrement des rows en bdd : | |
INSERT INTO school (name, capacity, country) | |
VALUES ('Ilvermorny School of Witchcraft and Wizardry',300,'USA'), | |
('Koldovstoretz',125,'Russia'), | |
('Mahoutokoro School of Magic',800,'Japan'), | |
('Uagadou School of Magic',350,'Uganda'); | |
Modification du Champ country la ou name = Durmstrang Institute: | |
UPDATE school SET country = 'Sweden' WHERE name='Durmstrang Institute'; |
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 | |
namespace Animals; | |
class Cat | |
{ | |
const FATIGUE_MAX = 100; | |
const FATIGUE_MIN = 0; | |
const FATIGUE_INCR = 10; | |
const FATIGUE_DECR = 10; |
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
Simple File Upload ( Quete : Laisse pas trainer ton file ) | |
Premier jet : Formulaire et traitement de l'upload pour un seul fichier. | |
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
Multi Files Upload ( Quete : Laisse pas trainer ton file ) | |
Second jet : Formulaire et traitement de l'upload pour un ou plusieurs fichiers. | |
=> Ne pas oublier selon l'importance des fichier à upload de modifier le fichier php.ini |
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
SELECT lastname,firstname,role,name FROM player | |
-> INNER JOIN wizard ON wizard.id = player.wizard_id | |
-> INNER JOIN team ON team.id=player.team_id ORDER BY name,role,lastname, firstname ASC; | |
+-----------------+-------------+--------+------------+ | |
| lastname | firstname | role | name | | |
+-----------------+-------------+--------+------------+ | |
| Black | Sirius | beater | Gryffindor | | |
| Brown | Lavender | beater | Gryffindor | | |
| Finnigan | Seamus | beater | Gryffindor | | |
| Hagrid | Rubeus | beater | Gryffindor | |