PHP: Simple Index Incrementor Method


/ Published in: PHP
Save to your folder(s)

A million different ways to incrementally increase a number, here's another.


Copy this code and paste it in your HTML
  1. function index(){
  2. static $idx = 0;
  3. $idx++;
  4. return $idx;
  5. }
  6.  
  7. echo index();
  8. echo index();
  9. echo index();
  10. echo index();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.