دورة php للمبتدئين الدرس الرابع
1- كيفاش نزيد des constantes ف php
//index.php
<?php
// $nom = 'samadi';
// echo $nom;
// $age = 20;
// echo $age;
// $note = 15.45;
// echo $note;
// $mineur = false;
// $majeur = true;
// $nom = "samadi";
// function getNom(){
// $nom = "alaoui";
// }
// $names = array('samadi','amine','hassan','adil');
// class Person{
// function Person(){
// return $this->nom = 'samadi';
// }
// }
// $person = new Person();
// echo $person->nom;
// $string = 'la vie est belle';
// echo strlen($string);
// $string = 'la vie est belle';
// echo strpos($string,'belle');
// $string = "la vie est belle";
// echo str_replace("la vie","ma fille",$string);
define('NOM','samadi');
echo NOM;
?>
2- l'opérateur = ف php
//index.php
<?php
// $nom = 'samadi';
// echo $nom;
// $age = 20;
// echo $age;
// $note = 15.45;
// echo $note;
// $mineur = false;
// $majeur = true;
// $nom = "samadi";
// function getNom(){
// $nom = "alaoui";
// }
// $names = array('samadi','amine','hassan','adil');
// class Person{
// function Person(){
// return $this->nom = 'samadi';
// }
// }
// $person = new Person();
// echo $person->nom;
// $string = 'la vie est belle';
// echo strlen($string);
// $string = 'la vie est belle';
// echo strpos($string,'belle');
// $string = "la vie est belle";
// echo str_replace("la vie","ma fille",$string);
// define('NOM','samadi');
// echo NOM;
$nom = 'samadi';
echo $nom;
?>
3- l'opérateur += ف php
//index.php
<?php
// $nom = 'samadi';
// echo $nom;
// $age = 20;
// echo $age;
// $note = 15.45;
// echo $note;
// $mineur = false;
// $majeur = true;
// $nom = "samadi";
// function getNom(){
// $nom = "alaoui";
// }
// $names = array('samadi','amine','hassan','adil');
// class Person{
// function Person(){
// return $this->nom = 'samadi';
// }
// }
// $person = new Person();
// echo $person->nom;
// $string = 'la vie est belle';
// echo strlen($string);
// $string = 'la vie est belle';
// echo strpos($string,'belle');
// $string = "la vie est belle";
// echo str_replace("la vie","ma fille",$string);
// define('NOM','samadi');
// echo NOM;
// $nom = 'samadi';
// echo $nom;
$x = 5;
$y = 8;
echo $x+=$y;
?>
4- l'opérateur -= ف php
//index.php
<?php
// $nom = 'samadi';
// echo $nom;
// $age = 20;
// echo $age;
// $note = 15.45;
// echo $note;
// $mineur = false;
// $majeur = true;
// $nom = "samadi";
// function getNom(){
// $nom = "alaoui";
// }
// $names = array('samadi','amine','hassan','adil');
// class Person{
// function Person(){
// return $this->nom = 'samadi';
// }
// }
// $person = new Person();
// echo $person->nom;
// $string = 'la vie est belle';
// echo strlen($string);
// $string = 'la vie est belle';
// echo strpos($string,'belle');
// $string = "la vie est belle";
// echo str_replace("la vie","ma fille",$string);
// define('NOM','samadi');
// echo NOM;
// $nom = 'samadi';
// echo $nom;
$x = 18;
$y = 8;
echo $x-=$y;
?>
5- l'opérateur *= ف php
//index.php
<?php
// $nom = 'samadi';
// echo $nom;
// $age = 20;
// echo $age;
// $note = 15.45;
// echo $note;
// $mineur = false;
// $majeur = true;
// $nom = "samadi";
// function getNom(){
// $nom = "alaoui";
// }
// $names = array('samadi','amine','hassan','adil');
// class Person{
// function Person(){
// return $this->nom = 'samadi';
// }
// }
// $person = new Person();
// echo $person->nom;
// $string = 'la vie est belle';
// echo strlen($string);
// $string = 'la vie est belle';
// echo strpos($string,'belle');
// $string = "la vie est belle";
// echo str_replace("la vie","ma fille",$string);
// define('NOM','samadi');
// echo NOM;
// $nom = 'samadi';
// echo $nom;
$x = 18;
$y = 8;
echo $x*=$y;
?>