$a = 1
$b = 1.2
$c = lalalala
$d = truc$c
$e = truclalalala
$f = truclalalala
$totale = 11.2lalalalatruc$ctruclalalalatruclalalala
<?php /* Variables I */
2
3 /* A lire :
4 http://fr.php.net/manual/fr/language.basic-syntax.php
5 http://fr.php.net/manual/fr/language.types.php
6 http://fr.php.net/manual/fr/language.variables.php
7 http://fr.php.net/manual/fr/language.expressions.php
8 http://fr.php.net/manual/fr/language.operators.php
9 */
10
11 /*
12 Ca, c'est un commentaire
13 */
14
15 # ça aussi c'est un commentaire ..
16
17 // de même
18
19 /*
20 Affectations de variables, pas de déclaration ..
21 Mais si on utilise des variables non initialisées, php nous gueule dessus (c'est pas propre).
22 */
23
24 $a = 1; /* a est un int qui vaut 1 */
25 $b = 1.2; /* b est un float qui vaut 1.2 */
26 $c = "lalalala"; /* c est un string qui vaut "lalalala", contrairement au C, c'est pas un tableau de char */
27 $d = 'truc$c'; /* d vaut truc$c */
28 $e = "truc$c"; /* d vaut truclalalala */
29 $f = "truc" . $c; /* f vaut truclalalala */
30
31
32 /* Le . sert a concatenner des choses ..., exemples : */
33 $totale = $a . $b . $c . $d . $e . $f;
34
35
36 /*
37 Affichage : on utilise <br/> pour le navigateur affiche bien des sauts de ligne, mais un \n suffit si on s'interesse qu'a ce qui est généré
38 */
39 echo '$a = '.$a.'<br/>';
40 echo '$b = '.$b.'<br/>';
41 echo '$c = '.$c.'<br/>';
42 echo '$d = '.$d.'<br/>';
43 echo '$e = '.$e.'<br/>';
44 echo '$f = '.$f.'<br/>';
45 echo '$totale = '.$totale.'<br/>';
46
47
48 /* On s'en fout là, c'est juste pour afficher la source */
49 include("hl.php");
50 hl('exemple1.php');
51 ?>