3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function guidv4() { $data = file_get_contents('/dev/urandom', false, null, 0, 16); $data[6] = chr(ord($data[6]) & 0x0f | 0x40); // set version to 0100 $data[8] = chr(ord($data[8]) & 0x3f | 0x80); // set bits 6-7 to 10 return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($data), 4)); } echo guidv4();
based on G3kL6
Output for 7.1.0
fca030af-c8eb-400f-b17a-5a0f6a3c931a
Output for 7.0.14
4c96c7e5-6658-4f3d-b709-fe821af576af
Output for 7.0.6
539124bf-ea22-4217-ba1e-8f51596dc11b
Output for 7.0.5
55e52d37-150e-4128-ad59-33f5f88abc6d
Output for 7.0.4
6d1729f9-5763-49ca-a10e-5c9deee0b174
Output for 7.0.3
fcbd7db1-d050-4b37-9595-30874f91499c
Output for 7.0.2
f09a935d-9511-409d-8b07-61e6293d4d0f
Output for 7.0.1
83107653-79ed-4c47-a9fd-10feeaa6ffc8
Output for 7.0.0
1a7f4e69-df21-48fd-a5af-2704b83c81ae
Output for hhvm-3.12.0
68c67900-3f83-4057-a2fb-48a78ca2f8b8
Output for hhvm-3.10.0
2825639d-c5d9-44eb-8a08-970a30e63a99
Output for 5.6.28
ba0a74ba-a74b-4ce3-85c4-da67cabb8130
Output for 5.6.21
2066b9f2-3c59-44f8-9902-e400fc0defe1
Output for 5.6.20
34c12aef-4490-41ad-9a2e-c8ee5c0ced49
Output for 5.6.19
687b28b7-3bd2-4ece-a0ce-33a4bac19951
Output for 5.6.18
7e22cdc4-4b3e-4a59-9d5c-fde0b690cdbb
Output for 5.6.17
e5353c34-4b17-4ba7-93e6-246456bcef8f
Output for 5.6.16
e74591a1-f6bf-4e1c-a8d7-29e8f5e390ed
Output for 5.6.15
60ac9ced-ecdb-4993-9517-3a673bb195b9
Output for 5.6.14
be1cac81-1d34-4036-bd9b-a12b79e19a0f
Output for 5.6.13
4928ea6a-ed0b-4e8d-88c6-a966751c6045
Output for 5.6.12
b90b93f1-d007-45bd-9fc4-57567066c967
Output for 5.6.11
7350a5eb-a4aa-46d8-b979-e675428182c3
Output for 5.6.10
0ff42327-55e9-42d6-bb09-88ded3675021
Output for 5.6.9
f60245f7-ea69-4766-b2ae-05b0fac88a16
Output for 5.6.8
ab6301ed-507b-4e8d-a981-183b681205e9
Output for 5.5.35
68d28135-3581-45fa-9373-30dc941563a1
Output for 5.5.34
6aa50720-c620-4bee-8415-8906e674e033
Output for 5.5.33
cc1467fc-ffd1-4f47-8bf8-936426df02ff
Output for 5.5.32
3a776693-7de0-4b16-a731-1bb05f3f0a46
Output for 5.5.31
f59b19c8-d3ae-4b81-9af2-fee51683ea7f
Output for 5.5.30
23557422-8c8b-40d7-b6ac-1ed5c32076e2
Output for 5.5.29
9beb6250-a829-41f5-8ede-bfea9fc81cfa
Output for 5.5.28
67740332-2479-44a1-9dba-a52bdb4f1581
Output for 5.5.27
6eaf9b5f-29d6-48e9-9384-1cb7a4730846
Output for 5.5.26
d588eeb7-f63c-4c0b-9fd7-993820c1953c
Output for 5.5.25
b8fdb99d-e71b-41b1-b85a-39ba074e6160
Output for 5.5.24
6914dde1-3982-4041-b8e0-dff580918b01
Output for 5.4.45
65433678-5d3d-4ed5-a430-129036edeb8d
Output for 5.4.44
67e76bfb-f842-4472-b0b5-ad72973f19ea
Output for 5.4.43
eccc4971-790d-497d-a59f-56801b76ce5b
Output for 5.4.42
3ebd3df3-d951-4d69-905b-8938e03b1f25
Output for 5.4.41
ce121d51-b0b0-4efe-bee7-b69da7d8d1b2
Output for 5.4.40
793d24be-67cf-497d-8406-67b078ca4c7c
Output for 5.4.39
2b18bfcd-a820-4666-91bc-4496c40d7c91
Output for 5.4.38
552ff25d-3286-4916-ade8-ba4d0b7c33a1
Output for 5.4.37
b907a6df-c1da-4ea0-b9da-241f61486bb4
Output for 5.4.36
d7b62351-c22e-4dd4-a942-6cdd309ccb69
Output for 5.4.35
54b3bb87-5ca5-4794-9974-f4d6559cd610
Output for 5.4.34
24ab0df9-05d2-47c2-a0e2-491bb1396424
Output for 5.4.32
908c4f84-e00a-4fe2-b7ca-4836396bdf2b
Output for 5.4.31
5579a736-fcd1-4a98-b578-00f102b82a6d
Output for 5.4.30
43152a6b-5668-4843-992f-5e78be0f397c
Output for 5.4.29
5eb77988-4cf6-4c6c-abd9-6728a043cb3e
Output for 5.4.28
5849feef-8931-4365-8e49-257ef31063d9
Output for 5.4.27
9ea05b40-911d-4ec5-bd00-25d28a73ea79
Output for 5.4.26
6e909c8c-246c-44bd-af26-919dd5a2828b
Output for 5.4.25
acac6358-182b-48aa-bd43-843c5eb666b5
Output for 5.4.24
d68a147f-e26c-4251-864c-9cfbb0116bd1
Output for 5.4.23
8914f4ae-7576-4ade-91f8-84d9de58e6e6
Output for 5.4.22
de37a779-9a31-4d2f-8567-ae3a02ed914f
Output for 5.4.21
22bd2fda-840a-4731-91af-c17a5832413d
Output for 5.4.20
7d70224a-600f-409e-a4a7-e5528fbe2adf
Output for 5.4.19
c9638118-72ec-4986-af0b-6bfd957b18c3
Output for 5.4.18
59cc0597-c097-4a7a-871e-a2e7b9dd2674
Output for 5.4.17
cc4fd693-ce8f-4253-b6ff-5cac13ebca0f
Output for 5.4.16
c83ed309-c5db-4b86-8775-90a70e8246ee
Output for 5.4.15
f78480a6-1a78-4ff9-9ee5-adfeadddae58
Output for 5.4.14
f7fe7b2b-aba5-4169-9654-2e71bc00f39b
Output for 5.4.13
e6c9418b-420b-4d02-ac91-fd41bd747f5b
Output for 5.4.12
9bd1baab-12a7-43eb-b7d4-8b5bdcc75c8e
Output for 5.4.11
2e1970f7-dfc7-4fa6-b831-d47a7affa63f
Output for 5.4.10
eb01f00f-c7f3-4c90-8df2-cd0449821f4b
Output for 5.4.9
a7452d62-b198-44fb-af4b-b5186a344a2e
Output for 5.4.8
6108167c-078a-4de7-bf5f-1c7cd563ca5e
Output for 5.4.7
ce5cc44c-ce56-4c78-9375-e9d44421b29f
Output for 5.4.6
439ed917-951f-4bce-93d5-1c36423186aa
Output for 5.4.5
69e0d4d9-4009-4d67-9f59-4a0a75f71ca0
Output for 5.4.4
61b65573-d44b-4430-969c-e44ae221123f
Output for 5.4.3
361aea83-a2c5-42ac-80e1-4dcb0b1c684e
Output for 5.4.2
73c96cf7-c486-4e8d-bf1c-0e2f68a41af1
Output for 5.4.1
f05ea086-bd73-4a08-a26e-262ec3d9af57
Output for 5.4.0
2f76fd56-f098-4904-9ea9-1dbcada9e4a9
Output for 5.3.29
3cf76bc2-3f15-4531-b7d1-67012c9b5746
Output for 5.3.28
5ec625f3-61a3-4375-90ae-aeaba8de007e
Output for 5.3.27
79d8b4f6-0e81-4fec-bee2-d3586ef276a2
Output for 5.3.26
c9fe3a7f-1a51-4f34-a6b1-cde5f95323a1
Output for 5.3.25
458bd0f6-15eb-40d3-82c9-9ed311257a34
Output for 5.3.24
768bae4a-1f91-40e4-b053-d96012ecb147
Output for 5.3.23
661bf9e9-118e-4be2-8e01-7e9cfb47882a
Output for 5.3.22
e7dd9573-814a-4f71-8bc2-7522bf0260da
Output for 5.3.21
2faa5ee6-d6c9-40ff-8809-e568644dc8f9
Output for 5.3.20
b0faeb0d-b2f2-4448-b108-835aaaf4fedb
Output for 5.3.19
aa32dc62-5160-4114-a706-a4da566c6b0e
Output for 5.3.18
2dfe047b-e622-4060-8655-ba46634a6b1e
Output for 5.3.17
0bd267f8-6367-4a97-aefd-8337b342332d
Output for 5.3.16
45442da1-e1da-4b15-9a3b-d4f3f1d102c0
Output for 5.3.15
02dac5fc-b2cb-493d-8ced-2de01ecea666
Output for 5.3.14
d7e5abc4-fdb8-4d48-bab1-59a513b78445
Output for 5.3.13
138027a1-494c-4a0a-a68a-669e80781e73
Output for 5.3.12
767600c1-1898-4b8e-b8de-77952e84be75
Output for 5.3.11
3ad05e69-390c-4574-bf73-573a4fcb6b22
Output for 5.3.10
ba5a1d57-8aac-487b-8ea9-bba66bb1961b
Output for 5.3.9
2b6b5e67-0e16-4ddf-94dd-dbc12b412e30
Output for 5.3.8
94b957a5-3a24-43fb-97bc-87f44498dc01
Output for 5.3.7
5ba527ad-c4f6-4fd0-a23a-375906d7b26b
Output for 5.3.6
ef457d46-97a5-4721-b658-991f28eaac2b
Output for 5.3.5
cb3b6083-c653-4951-82b1-3a7ab705766e
Output for 5.3.4
695538f2-eeaf-442d-90e2-029a6dd132e4
Output for 5.3.3
ae3adf2d-3220-40e4-946c-68e202f23be8
Output for 5.3.2
c8480b91-c397-4b6a-8f42-cc0c97429165
Output for 5.3.1
520f67d5-3ca2-46ec-a476-521a1d33801d
Output for 5.3.0
36e3d3cc-65fe-4e97-9b76-ad1f830b2198
Output for 5.2.17
bb8c12bd-6579-43b7-9a27-46166f5ce0c1
Output for 5.2.16
c8f56b31-e87a-46c7-b647-74d29aa38080
Output for 5.2.15
58d77e3f-e8f8-4ebf-8657-096dae29613f
Output for 5.2.14
b2e599bb-2776-46da-a2a0-69c6d0c334c8
Output for 5.2.13
e0af14ec-7381-44ba-b509-e859d5cab75f
Output for 5.2.12
cfcd9bdc-719e-42d5-a86e-f54de8653581
Output for 5.2.11
ad690864-8ee6-46fe-a2d7-804ace90d664
Output for 5.2.10
b2dab714-a4fa-4cf1-bb32-40a3fe062a40
Output for 5.2.9
5520bcdb-8870-410e-aae5-9b2f7c104564
Output for 5.2.8
1db63b45-4436-4200-b205-1aaa589de0b6
Output for 5.2.7
c553efc7-10ad-45db-8a5a-8f23d0cf0220
Output for 5.2.6
cec852e0-e4d5-4928-9431-00f974a93771
Output for 5.2.5
e3310b9c-d2bd-410f-9a35-2064872de45f
Output for 5.2.4
4b4d4797-fc0d-4bcf-b01f-261a5099db01
Output for 5.2.3
df2e8c82-08c7-4684-a26e-16b82efd07bb
Output for 5.2.2
f8bfbcaa-d21c-48ed-9313-5ca11aee5006
Output for 5.2.1
b69e8309-93e4-4400-a00c-bbf1b3b5bb8b
Output for 5.2.0
7bdb6b01-420c-4280-b933-d0a2efd90471
Output for 5.1.6
ff608a47-af44-4b4a-a994-42b05cd8a5d2
Output for 5.1.5
3cfed555-dd18-45df-9f16-37c5b08ed84b
Output for 5.1.4
9c8d74e5-beb8-4a4d-906a-675b34c6592f
Output for 5.1.3
f06604b7-4dc8-4126-b106-c8541d00b6eb
Output for 5.1.2
a9dc6941-ec3a-4073-b1ef-d8fc4003bcda
Output for 5.1.1
076fabea-40d1-4341-b1b3-eb6cc7f11f6b
Output for 5.1.0
8df62bb4-058c-4774-b3ff-9b94a30c6d53
Output for 5.0.0 - 5.0.5
Warning: file_get_contents() expects at most 3 parameters, 5 given in /in/fVj1e on line 3 Notice: Undefined offset: 8 in /in/fVj1e on line 5 Notice: Array to string conversion in /in/fVj1e on line 6 Warning: vsprintf(): Too few arguments in /in/fVj1e on line 6
Output for 4.4.5 - 4.4.9
Warning: file_get_contents() expects at most 2 parameters, 5 given in /in/fVj1e on line 3 Notice: Undefined offset: 8 in /in/fVj1e on line 5 Fatal error: Call to undefined function: str_split() in /in/fVj1e on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Warning: file_get_contents() expects at most 2 parameters, 5 given in /in/fVj1e on line 3 Notice: Undefined offset: 8 in /in/fVj1e on line 5 Fatal error: Call to undefined function: str_split() in /in/fVj1e on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Warning: file_get_contents() expects at most 2 parameters, 5 given in /in/fVj1e on line 3 Notice: Undefined offset: 8 in /in/fVj1e on line 5 Fatal error: Call to undefined function: str_split() in /in/fVj1e on line 6