Skip to content

Instantly share code, notes, and snippets.

View jimmyachour's full-sized avatar
🏠
Working from home

jimmyachour

🏠
Working from home
  • Bordeaux
View GitHub Profile
@jimmyachour
jimmyachour / index.php
Created March 10, 2019 20:35
Multidimentionel array and Display
<?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 :";
@jimmyachour
jimmyachour / index.php
Created March 11, 2019 09:17
Take the best weapon
<?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';
@jimmyachour
jimmyachour / index.php
Created March 11, 2019 14:57
Fonction writeSecretSentence
<?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");
@jimmyachour
jimmyachour / Personne.php
Last active March 22, 2019 10:16
classe personne
<?php
class Personne
{
public $name;
public $lastName;
public $address;
public $birthday;
public $allInformation = [];
@jimmyachour
jimmyachour / requete.txt
Last active March 23, 2019 21:27
Récupérer des informations avec SELECT
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 | |
@jimmyachour
jimmyachour / manipulation.sql
Created March 24, 2019 12:10
Manipulation des données
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';
@jimmyachour
jimmyachour / Cat.php
Created March 25, 2019 16:40
Atelier: Introduction POO
<?php
namespace Animals;
class Cat
{
const FATIGUE_MAX = 100;
const FATIGUE_MIN = 0;
const FATIGUE_INCR = 10;
const FATIGUE_DECR = 10;
@jimmyachour
jimmyachour / ReadMe.txt
Last active March 31, 2019 11:30
Simple File Upload
Simple File Upload ( Quete : Laisse pas trainer ton file )
Premier jet : Formulaire et traitement de l'upload pour un seul fichier.
@jimmyachour
jimmyachour / ReadMe.txt
Created March 31, 2019 11:35
Multi Files Upload
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
@jimmyachour
jimmyachour / index.txt
Created April 8, 2019 16:07
Les jointures
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 |