You appear to be a bot. Output may be restricted
Description
Gets unique ID.
This is a PHP implementation of Underscore's uniqueId method. A static variable contains an integer that is incremented with each call. This number is returned with the optional prefix. As such the returned value is not universally unique, but it is unique across the life of the PHP process.
Usage
$string = twentytwenty_unique_id( $prefix );
Parameters
- $prefix
- ( string ) optional – Prefix for the returned ID.
Returns
string Unique ID.
Source
File name: twentytwenty/inc/template-tags.php
Lines:
1 to 7 of 7
function twentytwenty_unique_id( $prefix = '' ) { static $id_counter = 0; if ( function_exists( 'wp_unique_id' ) ) { return wp_unique_id( $prefix ); } return $prefix . (string) ++$id_counter; }