note 76684 deleted from function.define by cmb
| From: | cmb@php.net | Date: | Sun, 06 Oct 2019 07:52:45 +0000 |
| Subject: | note 76684 deleted from function.define by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212477@lists.php.net to get a copy of this message | ||
Note Submitter: smifffy at smith-net dot org dot uk
----
a basic function to auto assign a numeric value that increase by itself each time - used in some
permission style scripts
<?php
function define_bitwise($constant_name, $reset = False)
{
static $bitwise_next = 1;
if ( $reset === True )
{
$bitwise_next = 1;
}
define($constant_name, $bitwise_next);
$bitwise_next += $bitwise_next;
}
?>
when reset it set to True, resets that value to 1 and starts afresh