Designed by NoKi !
3 en ligne  


 Search


Acheter - Vendre
neuf et occasion

pda, jeux vidéo, graveur, cd vierges, dvd vierges, matériel informatique, pc, ordinateur portable, logiciel, antivirus, annonces gratuites





   

Some basics (1/3)

Variables, tables, functions and procedures





artvoila
Upon request of beginers, some basic information to better understand...


Questions - Variables - Tables - Functions - Procedures



Variables

They are containers enabling to store information that is reusable in multiple positions in code
  • Statement: To select the name of a variable you must :
    1. Check that this name is available (key word or variable of language) ;
    2. That the name in embedded with letter, figures or _ (underscore) ;
    3. That the first character is NOT capital letter ;
    4. With PHP enter the symbol $ in front of the first letter.

  • Allocation : We use the symbol = to fill in a container with data:
    myvar_1 = "hello" $myvar_1 = "hello";put the string "hello" in the variable
    myvar_2 = 250 $myvar_2 = 250;put the number 250 in the variable
    myvar_3 = true $myvar_3 = true;put the value true in the variable
    myvar_4 = myvar_2 $myvar_4 = $myvar_2;put in the myvar_4 variable the value included in the variable myvar_2

  • Categories : So, you understand that you cannot reserve the the same memory space to put in storage a number and a long chain of characters... Also, the language needs to know the kind of information that a variable contains.... Each variable is classified when first built-in; it means the kind of information stored in the variable is primarily determined... Be aware of any mistake you can enhance if you do not respect this rule!

  • Read : A data in a container is readable just by mentioning its name
    For example, if you want to post: <% = myvar_1 %> or <? echo $myvar_1; ?>

  • Operations : We can, obviously, build the content of a variable in a different and smarter way... Some examples:
    myvar_1 = "bon" & "jour" $myvar_1 = "bon"."jour";Concatenation
    of two strings
    myvar_2 = 50*5 $myvar_2 = 50*5;Arithmetic
    + - * /
    myvar_3 = (myvar_2 = 250) $myvar_3 = ($myvar_2==250);Comparison
    = (== en PHP)
    > >= < <=
    <> (!= en PHP)
    myvar_2 = myvar_2 + 12
    myvar_1 = myvar_1 & " Didier"
    $myvar_2 += 12;
    $myvar_1 .= " Didier";
    Modification
    .= += -= ... in PHP


  • Dynamic variables: Sometimes, it could be better to store (or build) a variable within another variable ... And, we will develop as follow to read its content:

    <%
    truc_fr = "Bienvenue"
    truc_en = "Welcome"
    lang = "fr"
    execute "response.write truc_" & lang
    %>

    <?
    $truc_fr = "Bienvenue";
    $truc_en = "Welcome";
    $lang = "fr";
    echo ${"truc_".$lang}; // display Bienvenue
    ?>


  • PHP 4 allows assign values to variables based on reference...
    Just put a & before the name of a variable... an example :

    <?
    $var_1 = "Essai"; echo $var_1; // display Essai
    $var_2 = &$var_1; echo $var_2; // display Essai
    $var_1 = "Test"; echo $var_2; // display Test !
    $var_2 = "Try"; echo $var_1; // display Try !
    ?>


    And, if you want to get more about references...

artvoila on 12/14/2003 (7 414 hits)
Didier Téléchargez gratuitement !!!
7 logiciels illimités dont Visual Studio Pro et SQL Server 2005 !
SQL Server 2008 ß !
[gratuit] 11-12-13 février
les MS TechDays 2008 !!!
Au fil des news  
Dreamweaver CS3 + XML + Ajax - Création d'une région détail
Dans cet article, je vais vous montrer comment utiliser la technique région détail, avec Spry
PHP - joli arborescence dynamique
Magazines - Le N°104 de Programmez est disponible
PHP - PhPBB 3.0.0 !!!
[MAJ] Université de Sherbrooke - située dans un beau coin du Québec, l'Estrie...
- Ajout du programme d'imagerie et de médias numérique - Le département de mathématiques et ...
Magazines - Le N°103 de Programmez est disponible
PHP - Calcul jours ouvrables entre dates, gestion fériés
PHP - WampServer 2.0, la nouvelle version de WAMP5 !
SharePoint 2007 et Workflows Designer - Part 2 - Modifions un workflow dans SharePoint 2007
Dans la première partie, nous avons vu comment créer un WorkFlow dans MOSS avec SharePoint ...
Modifier le ruban de Word 2007 avec Open XML -
Open XML est un format de document bureautique flexible : structure basée sur l'Open Packaging ...
La corbeille de SharePoint 2007 - Fonctionnement de la corbeille de SharePoint 2007
Une des nouveautés de SharePoint 2007 est la mise en place de la corbeille pour chaque site. Il est ...
SharePoint 2007 et Workflows Designer - Part 1 - Créer un workflow simple dans SharePoint 2007
L'automatisation de Workflows, ou Flux de travail, résulte d'une volonté d'amélioration de ...
CSS - Dégradé de couleur
Magazines - Le N°102 de Programmez est disponible
Dreamweaver CS3 + Mysql - Formulaire de redirection
Suite au coup de pouce de DB77, je vous propose ce petit script pour améliorer vos pages Internet. ...
[MAJ] Tutoriel AJAX simple - En avant vers le WEB2.0
Mis à jour le 26/10/2007
Magazines - Le Hors-Série .Net de Programmez est disponible
LINQ et vous - Part 2 - Le .NET Framework 3.5 décortiqué !
Ce nouvel article fait suite à mon premier article de cette nouvelle collection « LINQ et vous ». ...
Présentation des KPI dans SharePoint - Présentation des KPI dans SharePoint 2007
Nous verrons au travers de cet article une présentation détaillée de ce qu'est un KPI et dans quel ...
LINQ et vous - Part 1 - Evolutions du .NET Framework - Visual Studio 2008
Voilà plus d'un an que je n'ai plus posté d'articles sur ma communauté préférée. Il était temps ...
Agenda - 21-22 novembre : Le Forum PHP 2007 !
Microsoft - Essayez gratuitement MS Expression Studio !!!
Les Utilisateurs dans SharePoint - La gestion des utilisateurs dans SharePoint
SharePoint dont le coeur est l'outil collaboratif, Windows SharePoint Services. Chaque utilisateur ...
Magazines - Le N°101 de Programmez est disponible
Hebergement - hébergement de forum gratuit - créer un forum.
Revue de presse - Nouvelle mise à jour chez Adobe
PHP - import csv vers bdd avec verification
PHP5 - Csv2array
PHP - Framework PHP5 - PoppyFramework
Le Moteur de Recherche de MOSS 2007 - Installer le moteur de recherche de MOSS 2007
Nous avons vu dans un précédent article comment mettre en place le moteur de recherche dans un site ...
PHP5 - incrementation alphanumerique
Magazines - Le N°100 de Programmez est disponible
Agenda - Adobe vous donne rendez-vous du 4 au 9 septembre..
ABAP leçon 1 : Les variables - Auteur : Jerome Fortias
je me devais de continuer mon travail de vulgarisation à SAP. En parallèle à mon site destiné aux ...
Agenda - Nov 2007 : Les TechEd Developers à Barcelone !
Microsoft - Vista SP1 et XP SP3 pour bientôt !
Le Moteur de Recherche de WSS V3 - Installer le moteur de recherche de WSS V3
Parmi les évolutions de Windows SharePoint Services V3, on trouve le moteur de recherche. Nous ...
PHP - array2xml convertie un array en xml
Revue de presse - Flash Player 9 Update beta
PHP5 - class Timer - ajouter/enlever du temp au time unix
Tutorial : HTML | Scripting | ASP-PHP | ASP.net | SQL Server | XML
Sharepoint | XAML | Pocket | Dreamweaver | VML | Divers
  Scripts : Scripting | ASP-PHP | ASP.net | Divers
  Boutique | Annuaire | Bannières | Météo | Tribune | Partenariats
v3 © Didier 2003   
 
 MVP DotNet Project Groupes Utilisateurs Microsoft Codes Sources ASP-magazine TechNet Wygwam The Inquirer FR El Roubio CodePPC