This week's book giveaway is in the Artificial Intelligence and Machine Learning forum.
We're giving away four copies of Succeeding with AI and have Veljko Krunic on-line!
See this thread for details.
Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Wondering why my variable doesn't increment inside of a function

 
Greenhorn
Posts: 9
PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I'm new to PHP and to functions, so I'm a bit confused as to why my variable isn't incrementing inside of a function.

Here's what I basically have:



But the echo $atriskbanks prints a 0, which is what I initialized the variable to earlier. So it's definitely not incrementing. ($ratio>75 is true in this case. $ratio is 100 point something).

Does anyone know why this variable isn't incrementing when I call the function?

Thank you very much for any thoughts you may have about this.
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Brenda, this page should explain what the problem is and how to fix it: https://www.php.net/manual/en/language.variables.scope.php
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic