No cache version.

Caching disabled. Default setting for this page:enabled (code LNG204)
If the display is too slow, you can disable the user mode to view the cached version.

Vous devez être membre et vous identifier pour publier un article.
Les visiteurs peuvent toutefois commenter chaque article par une réponse.

Passage d’arguments par référence ou par valeur en P

Astuces de l’Infobrol (Développement)Article publié le 06/11/2005 08:09:38


En PHP, il est possible de passer les arguments à une fonction par valeur (portée locale), ou par référence (les modifications dans la fonction portent sur la variable extérieure):
  1. $arg1 = 0;
  2. $arg2 = 0;
  3. printf $newline + "values before: " + $arg1 + ", " + $arg2;
  4. function myfunction($arg1, &$arg2){
  5. $arg1++;
  6. $arg2++;
  7. printf $newline + "values in function: " + $arg1 + ", " + $arg2;
  8. }
  9. printf $newline + "values after: " + $arg1 + ", " + $arg2;


Ce qui affiche:

values before: 0, 0
values in function: 1,1
values after: 0,1



Avatar :: Lea72 Un article de Lea72Modifié 2 fois. (dernière modification le 06/11/2005 08:11:06 par Lea72)



Source : indéterminée


Commenter l'article

Commentaires


06/11/2005 08:12:45 : erreur de coloration

La coloration du code n'est pas bonne (elle ne sort pas du string entre "").

- Lea72 -

Sélection, tri et recherche d'articles
FILTRER :
TRIER :1er critère : 2e critère :
CHERCHER : Dans les titres Dans le contenu


[Afficher les liens en fonction des critères du formulaire ci-dessus]

English translation

You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.

If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.

Thank you in advance.

Document created the 13/09/2004, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/ast-rf-254.html

The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.