PHP code example of foamycastle / uuid

1. Go to this page and download the library: Download foamycastle/uuid library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

foamycastle / uuid example snippets


$uuid=UUID::Make(UUID::Version1);
//$uuid can now be used a string.
echo $uuid;
//output: 9ecfcb86-8514-11ef-8000-f01898ea0078

$uuid->refresh();
echo $uuid;
//output 5d3299da-8517-11ef-8000-f01898ea0078

$uuid=UUID::Make(UUID::Version1);
$batch=$uuid->batch(4);

print_r([...$batch]);
/*output:
Array
(
    [0] => 092ae780-8516-11ef-8000-f01898ea0078
    [1] => 092ae780-8516-11ef-8001-f01898ea0078
    [2] => 092ae780-8516-11ef-8002-f01898ea0078
    [3] => 092ae780-8516-11ef-8003-f01898ea0078
)
*/