title: PHP - Incrementing Variables Efficiently
body: <p>Im using functions for logging in a user, When they login but fail either by no captcha sent, failed captcha or failed login it will give there IP a <code>Try</code>. When they reach 5 tries they get blocked from the login page for approximately 1 hour. I have a function that updates the MySQL Column to increment there try count and last try date. But from looking at PHP's documents it states:</p>
  
  <blockquote>
    <p>Note: The increment/decrement operators only affect numbers and
    strings. Arrays, objects and resources are not affected.</p>
  </blockquote>
  
  <p>My function gets the try count from the Database and then tries updating it. My SQL result for fetching the Try count is by default an Array because of how PDO works. So how can I efficiently increment an array?</p>
  
  <p>I was thinking of doing a foreach condition and use the <code>.=</code>opperator to save it to a string and from there increment. But is that really the most efficient way?</p>
  
  <p>Thank you.</p>
  
  <p>P.S: I'm not showing any example code e.t.c because this question is simple enough. I have searched around on here and couldn't find a proper answer.</p>