Created
June 5, 2014 10:51
-
-
Save albabar/90b43b8f1fa4f77ca7da to your computer and use it in GitHub Desktop.
Au Increment in HTML tables, like foreach loops. If you want to use it with loop and want to reset the counter, please reset it outside loop. Made it for laravel blade, is it's pain to assign a variable in blade.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function increment($reset = false, $l = 0) { | |
| static $i; | |
| if($reset) $i = $l; | |
| else return ++$i; | |
| return $reset; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment