Posted By

chrisaiv on 11/24/09


Tagged

php


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

kirik
xmartyxcorex


PHP: Simple Index Incrementor Method


 / Published in: PHP
 

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

  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  

You need to login to post a comment.