PHP : Introduction
1. PHP ?
Définition
PHP is a server-side scripting language
designed for web development but also
used as a general-purpose programming
language.
Source : http://en.wikipedia.org
Une histoire du PHP
1994 - Développé par Rasmus Lerdorf
1997 - Re-développement par Andi Gutmans et Zeev Surask
2004 - Introduction de la modélisation objet
2011 - Accélération du processus de livraison de version
81,3 %of all the websites use PHP.
Source : w3tech
Quelques spécificités métiers
Gratuit
-
Une immense communauté
-
Facile à apprendre
-
Très utilisé en France
Quelques spécificités techniques
Multiplate-forme
-
Langage très permissif
-
Langage non compilé
-
Exécution côté serveur
-
Produit du code html
Qui utilise PHP ? (1)
Qui utilise PHP ? (2)
L'écosystème PHP
Salaire du développeur PHP
Source : baromètre AFUP, http://afup.org
2. Un programme PHP
2.1 Outils & configuration
Les outils du développeur PHP (1)
FireFox Chrome Chrome Canary
Les outils du développeur PHP (2)
Sublime Text BracketsAtom.io
Serveur local
MAMP WAMP LAMP
ToDo (1)
Télécharger : WAMP / MAMP / LAMP
Installer : WAMP / MAMP / LAMP
Lancer : WAMP / MAMP / LAMP
Aller à l’url : http://localhost ou http://localhost:8888
ToDo (2)
Créer un dossier « test » dans www ou htdocs
Créer un fichier « index.php » dans test
Dans le fichier index.php, écrire :
<?php echo «hello»; ?>
Aller à l’url : http://localhost/test/index.php
ou http://localhost:8888/test/index.php
2.2 code PHP ?
Un fichier PHP
<?php echo 'Hello world' ; ?>
<?php
echo 'Hello ';
echo 'world';
?>
PHP & HTML
<h1>
<?php echo 'Hello world' ; ?>
</h1>
Commentaires
<?php // echo 'Hello world' ; ?>
3. Valeurs
2.1 Nombres
Définir un nombre
890 // entier
-87 // entier négatif
8.7 // décimal
2.2 Chaînes de caractères
Définir une chaîne de caractères
"When I get sad I stop being sad and be AWESOME instead."
'True story!'
2.3 valeurs spéciales
Booléens
true // vraie
false // faux
Null
La valeur spéciale NULL représente une variable sans
valeur.
3. Opérateurs
3.1 Manipulation
Arithmétique
3 + 2 // 5;
3 - 2 // 1;
3 * 2 // 6;
3 / 2 // 1.5;
3 % 2 // 1;
3 * 2 + 2 // 8;
Concaténation
<?php echo "If you're committed enough, you can make
any story work." . " I once told a woman I was Kevin
Costner, and it worked because I believed it." . " - Saul
Goodman"; ?>
// If you're committed enough, you can make any story
work. I once told a woman I was Kevin Costner, and it
worked because I believed it - Saul Goodman
3.2 Comparaison
Numérique
3 > 2 // true
3 < 2 // false
8 == 9 // false
8 != 9 // true
9 >= 9 // true
9 <= 10 // true
Logique
true && true // true
true && false // false
false && false // false
true || true // true
true || false // true
false || false // false
!true // false
!false // true
3 + 4 == 7 && 2 * 8 > 10 // true
Merci pour votre attention.
Bibliographie
Eloquent JavaScript - Marijn Haverbeke
http://eloquentjavascript.net
Dynamisez vos sites web avec Javascript ! - Johann Pardanaud & Sébastien de la Marck
http://fr.openclassrooms.com/informatique/cours/dynamisez-vos-sites-web-avec-javascript
JavaScript Fundamentals - Jeremy McPeak
http://code.tutsplus.com/courses/javascript-fundamentals
Guide JavaScript - teoli, BenoitL, delislejm, Ame_Nomade, SphinxKnight
https://developer.mozilla.org/fr/docs/Web/JavaScript/Guide
Javascript – MAX_INT: Number Limits - Vjeux
http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html
Lost - Jeffrey Lieber, J. J. Abrams, Damon Lindelof
http://abc.go.com/shows/lost
Crédits (1)
Person of interest - Jonathan Nolan, David Slack, Patrick Harbinson
http://www.cbs.com/shows/person_of_interest/
Halt and Catch Fire - Christopher Cantwell, Christopher C. Rogers
http://www.amctv.com/shows/halt-and-catch-fire
Utilities terminal Icon - kxmylo
http://www.iconarchive.com/show/simple-icons-by-kxmylo/utilities-terminal-icon.html
Breaking bad - Vince Gilligan
http://www.amctv.com/shows/breaking-bad
House of Cards - Beau Willimon
https://www.facebook.com/HouseofCards
The Big Bang Theory - Chuck Lorre, Bill Prady
http://www.cbs.com/shows/big_bang_theory/
Game of Thrones - David Benioff, D. B. Weiss
http://www.hbo.com/game-of-thrones
The Wire - David Simon
http://www.hbo.com/the-wire
Crédits (2)
Silicon Valley - Mike Judge
http://www.hbo.com/silicon-valley
The Killing - Veena Sud
http://www.amctv.com/shows/the-killing
Band of Brothers - Tom Hanks, Steven Spielberg
http://www.hbo.com/band-of-brothers

PHP #1 : introduction

  • 1.
  • 2.
  • 3.
    Définition PHP is aserver-side scripting language designed for web development but also used as a general-purpose programming language. Source : http://en.wikipedia.org
  • 4.
    Une histoire duPHP 1994 - Développé par Rasmus Lerdorf 1997 - Re-développement par Andi Gutmans et Zeev Surask 2004 - Introduction de la modélisation objet 2011 - Accélération du processus de livraison de version
  • 5.
    81,3 %of allthe websites use PHP. Source : w3tech
  • 6.
    Quelques spécificités métiers Gratuit - Uneimmense communauté - Facile à apprendre - Très utilisé en France
  • 7.
    Quelques spécificités techniques Multiplate-forme - Langagetrès permissif - Langage non compilé - Exécution côté serveur - Produit du code html
  • 8.
  • 9.
  • 10.
  • 11.
    Salaire du développeurPHP Source : baromètre AFUP, http://afup.org
  • 12.
  • 13.
    2.1 Outils &configuration
  • 14.
    Les outils dudéveloppeur PHP (1) FireFox Chrome Chrome Canary
  • 15.
    Les outils dudéveloppeur PHP (2) Sublime Text BracketsAtom.io
  • 16.
  • 17.
    ToDo (1) Télécharger :WAMP / MAMP / LAMP Installer : WAMP / MAMP / LAMP Lancer : WAMP / MAMP / LAMP Aller à l’url : http://localhost ou http://localhost:8888
  • 18.
    ToDo (2) Créer undossier « test » dans www ou htdocs Créer un fichier « index.php » dans test Dans le fichier index.php, écrire : <?php echo «hello»; ?> Aller à l’url : http://localhost/test/index.php ou http://localhost:8888/test/index.php
  • 19.
  • 20.
    Un fichier PHP <?phpecho 'Hello world' ; ?> <?php echo 'Hello '; echo 'world'; ?>
  • 21.
    PHP & HTML <h1> <?phpecho 'Hello world' ; ?> </h1>
  • 22.
    Commentaires <?php // echo'Hello world' ; ?>
  • 23.
  • 24.
  • 25.
    Définir un nombre 890// entier -87 // entier négatif 8.7 // décimal
  • 26.
    2.2 Chaînes decaractères
  • 27.
    Définir une chaînede caractères "When I get sad I stop being sad and be AWESOME instead." 'True story!'
  • 28.
  • 29.
  • 30.
    Null La valeur spécialeNULL représente une variable sans valeur.
  • 31.
  • 32.
  • 33.
    Arithmétique 3 + 2// 5; 3 - 2 // 1; 3 * 2 // 6; 3 / 2 // 1.5; 3 % 2 // 1; 3 * 2 + 2 // 8;
  • 34.
    Concaténation <?php echo "Ifyou're committed enough, you can make any story work." . " I once told a woman I was Kevin Costner, and it worked because I believed it." . " - Saul Goodman"; ?> // If you're committed enough, you can make any story work. I once told a woman I was Kevin Costner, and it worked because I believed it - Saul Goodman
  • 35.
  • 36.
    Numérique 3 > 2// true 3 < 2 // false 8 == 9 // false 8 != 9 // true 9 >= 9 // true 9 <= 10 // true
  • 37.
    Logique true && true// true true && false // false false && false // false true || true // true true || false // true false || false // false !true // false !false // true 3 + 4 == 7 && 2 * 8 > 10 // true
  • 38.
    Merci pour votreattention.
  • 39.
    Bibliographie Eloquent JavaScript -Marijn Haverbeke http://eloquentjavascript.net Dynamisez vos sites web avec Javascript ! - Johann Pardanaud & Sébastien de la Marck http://fr.openclassrooms.com/informatique/cours/dynamisez-vos-sites-web-avec-javascript JavaScript Fundamentals - Jeremy McPeak http://code.tutsplus.com/courses/javascript-fundamentals Guide JavaScript - teoli, BenoitL, delislejm, Ame_Nomade, SphinxKnight https://developer.mozilla.org/fr/docs/Web/JavaScript/Guide Javascript – MAX_INT: Number Limits - Vjeux http://blog.vjeux.com/2010/javascript/javascript-max_int-number-limits.html
  • 40.
    Lost - JeffreyLieber, J. J. Abrams, Damon Lindelof http://abc.go.com/shows/lost Crédits (1) Person of interest - Jonathan Nolan, David Slack, Patrick Harbinson http://www.cbs.com/shows/person_of_interest/ Halt and Catch Fire - Christopher Cantwell, Christopher C. Rogers http://www.amctv.com/shows/halt-and-catch-fire Utilities terminal Icon - kxmylo http://www.iconarchive.com/show/simple-icons-by-kxmylo/utilities-terminal-icon.html Breaking bad - Vince Gilligan http://www.amctv.com/shows/breaking-bad House of Cards - Beau Willimon https://www.facebook.com/HouseofCards The Big Bang Theory - Chuck Lorre, Bill Prady http://www.cbs.com/shows/big_bang_theory/ Game of Thrones - David Benioff, D. B. Weiss http://www.hbo.com/game-of-thrones
  • 41.
    The Wire -David Simon http://www.hbo.com/the-wire Crédits (2) Silicon Valley - Mike Judge http://www.hbo.com/silicon-valley The Killing - Veena Sud http://www.amctv.com/shows/the-killing Band of Brothers - Tom Hanks, Steven Spielberg http://www.hbo.com/band-of-brothers