![]() |
Re: [PHP] Addition funktioniert nicht mit Variable
Einfach das "var" weglassen und innerhalb der Funktion eben mit global kenntlich machen, dass es sich um eine globale Variable handelt.
|
Re: [PHP] Addition funktioniert nicht mit Variable
Zitat:
|
Re: [PHP] Addition funktioniert nicht mit Variable
Und bitte
Code:
verwenden, global is mehr oder weniger deprecated.
$_GLOBALS['loginpunkte'];
Andere Frage, wozu eine globalisierte Variable? Sowas macht man nicht. :-)
Code:
function addLoginPunkte($loginpunkte = 0)
{ $punkte = (int)getPunkte(); // Dem aktuellen Punktestand die Loginpunkte hinzufügen $punkte += $loginpunkte; echo $punkte; // schreibt sofort } $loginpunkte = 10 addLoginPunkte($loginpunkte); // Edit habs mal angepasst (danke an Valle) |
Re: [PHP] Addition funktioniert nicht mit Variable
Zitat:
Code:
Mit freundlichen Grüßen,
$punkte = (int)getPunkte();
Valle |
Alle Zeitangaben in WEZ +1. Es ist jetzt 12:21 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz