3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function guidv4() { $data = openssl_random_pseudo_bytes(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();
Output for 7.1.0
6f0c87af-d66c-4f23-aab5-123bd1c1c2ef
Output for 7.0.14
53167a03-5b2b-4ac1-b682-a07293eea042
Output for 7.0.10
df3400f3-1782-44a6-bd8b-fe1de6257ab3
Output for 7.0.9
7bff9691-f182-4fe4-b4fd-5b1aef81e2fb
Output for 7.0.8
fc028c22-6d47-4d7d-9478-375c9114ce2c
Output for 7.0.7
aca62d9a-dd3f-4f7d-bb56-48a07049b623
Output for 7.0.6
76ff5c43-8226-4ca1-af86-9ea5eaec4fce
Output for 7.0.5
2f46e6f3-3579-442e-ab06-d1f49d2beb4e
Output for 7.0.4
1d32226d-c7fd-4377-93ac-872ececdc5bd
Output for 7.0.3
e08807df-8593-4a6d-8eeb-b52a5009e58d
Output for 7.0.2
a8ec48ef-1a01-4210-9bfa-6dc80d6d8470
Output for 7.0.1
437eb0f8-3a3c-4530-a15a-6ea0b0b044b9
Output for 7.0.0
d6d1ae4c-46e7-43b5-be0c-caac768c78ae
Output for hhvm-3.12.0
042cf0d9-db20-4864-b65b-f61fe827c5f3
Output for hhvm-3.10.0
42e096a1-df54-4c2e-ac1a-dea04b45408d
Output for 5.6.28
e16f1b8c-300c-42a3-8d22-ff2812c609c1
Output for 5.6.25
8fa6e818-ef0b-443d-915d-1ae86af6ed58
Output for 5.6.24
d04bf94c-0f4b-46c5-b7f0-5515023dcd7a
Output for 5.6.23
f1f518b6-4eea-4f68-83dc-337dee98a169
Output for 5.6.22
db06f30e-446e-4698-b8ce-3f0ac43b9947
Output for 5.6.21
75464ff5-6931-4e5e-9589-82aadb8b0954
Output for 5.6.20
f8940a4f-8c5e-4875-82f8-4caec5317d3d
Output for 5.6.19
666ecbc8-1bb1-4e31-9dcf-4e965a362f26
Output for 5.6.18
20848146-1fe9-4211-907e-c27f0272d756
Output for 5.6.17
88de2ada-12cc-4fb2-968b-ca930073fbbb
Output for 5.6.16
7b28feda-2e44-442f-a465-01371e08918e
Output for 5.6.15
9214dfe2-34c3-4ba4-8321-b33fcb834500
Output for 5.6.14
6aed35b2-c744-4632-907f-5ad1674ea8fa
Output for 5.6.13
50a83597-4dd0-42ff-94a6-35b6f1edadb4
Output for 5.6.12
340bce4a-99b7-4157-a22e-64234ca24469
Output for 5.6.11
4e333af0-1da7-4fba-9ba8-30ad93387728
Output for 5.6.10
3479b197-f08c-4903-a8bc-5991985fe737
Output for 5.6.9
fc490061-7c5c-4c11-8876-13a5016cbca8
Output for 5.6.8
dde707e1-a9e6-42e3-8f06-eb86e8468747
Output for 5.6.7
e05ea5ec-b58b-428c-8e79-5090298aa54f
Output for 5.6.6
e8934172-5ef7-41fc-ae81-7b58e3a0547e
Output for 5.6.5
12b7c841-cdee-449b-9aeb-f993d3f3f9e5
Output for 5.6.4
e4a4de32-e6a0-4065-8698-bcba7d65a453
Output for 5.6.3
003ecdcb-fe06-4d6b-bb8f-b64c2bfde5c0
Output for 5.6.2
8baae973-5b72-4af8-bd96-aff33347eba0
Output for 5.6.1
8f2783c8-acd6-4c7c-b48b-0fc599c43538
Output for 5.6.0
ac1af32b-f840-43ad-9c0a-d99c019ed49f
Output for 5.5.38
7fcfd476-f80d-4ec6-8e5d-889c5c07462e
Output for 5.5.37
9e81b69c-df24-4d02-82ee-9198148b802c
Output for 5.5.36
b0f37625-1be6-46bd-abe3-d787a4aa24dc
Output for 5.5.35
50d35a1f-e117-4d63-8a30-4b74594e7c8e
Output for 5.5.34
df568429-4d1d-403f-acb8-6cfce33cbfcc
Output for 5.5.33
b8801ec9-009f-4189-bb40-ea2f9c4f681c
Output for 5.5.32
b7c6bcb3-f94d-427b-950f-44877e8f27fd
Output for 5.5.31
ecc4dba1-1c1c-4bb8-9028-a4be13348353
Output for 5.5.30
87792cc9-e448-4c84-b798-e07ef8d0c45e
Output for 5.5.29
7b8363c0-4af3-4cbc-b675-1eaa2b5f267e
Output for 5.5.28
6b27498c-4f2d-47e0-a345-e4da669c4911
Output for 5.5.27
93b32f3d-c143-40e6-a417-1263899d9dbb
Output for 5.5.26
d46af59e-f198-466a-a2a0-0c3c1b452998
Output for 5.5.25
20ce3579-f97d-497d-afc6-8c19534580cd
Output for 5.5.24
9c39cf8c-a9e3-48e1-a6f3-9439a181bb1a
Output for 5.5.23
e7878328-f2e4-44a4-bebb-71526dd85d88
Output for 5.5.22
65dec3d3-71cc-47a6-a271-8c99115b6a11
Output for 5.5.21
e9d09262-b0d5-43e0-9451-7bbfbe7f864d
Output for 5.5.20
15de01bb-83d1-4a02-8516-621a543157bd
Output for 5.5.19
99c9c110-bf39-4f39-b0f5-d10a139cc661
Output for 5.5.18
0a5d6cc7-1c69-47ea-8eb4-7c5fe162478d
Output for 5.5.16
fef9b992-2bdb-4222-a836-591a7245aae3
Output for 5.5.15
db9077bb-713d-4d98-83c1-e61218d839fc
Output for 5.5.14
8e91f321-18c6-4d02-9084-429fb5894243
Output for 5.5.13
6ff0c180-3545-43e5-a8ae-474356a0af13
Output for 5.5.12
bd100b92-f2f4-4f9b-a647-10bad255ae86
Output for 5.5.11
691cf4f8-7c44-46eb-bcbe-897280e0d931
Output for 5.5.10
9e015d18-dce3-48f3-b587-c8d343c7a833
Output for 5.5.9
a8a37f25-bc2f-49db-9f30-75a96c9dc7cb
Output for 5.5.8
faa1c82a-2255-4b2e-a01f-964f4ab47bbe
Output for 5.5.7
d53545da-01b2-41d8-adc0-8e28d1d36150
Output for 5.5.6
a5342298-4193-4214-9ec4-047e4e943dc5
Output for 5.5.5
726f747e-79c1-4b6c-aae1-8f34c5c743dc
Output for 5.5.4
be00a127-f6bf-4392-a0cb-b46a104d007f
Output for 5.5.3
1f05f326-9323-4c51-aa4d-8629dcab81fc
Output for 5.5.2
ab44c37c-bd78-4bc4-927e-1b49c1c1e09a
Output for 5.5.1
2d9d3cef-4eb8-40e1-b20d-724251631d69
Output for 5.5.0
a98bebf3-147b-43ad-b070-2ee478aa344c
Output for 5.4.45
20050f02-fef3-43ae-b11e-df1fc08d7390
Output for 5.4.44
e7c1f6a3-97b2-4136-b040-50bf8cde07d1
Output for 5.4.43
bf1bd435-75d9-4318-9108-e4efa4d63dbe
Output for 5.4.42
367ed23e-4b18-4998-acb1-cf307c13736d
Output for 5.4.41
7f566862-a46d-4b94-a2f4-dbb328683518
Output for 5.4.40
84e55c35-6459-4589-8b1d-dd8b1c38c150
Output for 5.4.39
cbc1e56b-a70c-496e-ba27-3cd7364e7c53
Output for 5.4.38
c3645cf9-ca14-4a7b-b99a-4ba80eac3466
Output for 5.4.37
942e9f47-b879-403d-85a4-991b0472abdb
Output for 5.4.36
a0a42b19-9dd7-46b0-8790-d6c70b9deb4c
Output for 5.4.35
427910a8-df4a-44b6-99e0-b6cb3c3bb2a9
Output for 5.4.34
24f9b831-4290-4e3d-a36b-d008ac1755c3
Output for 5.4.32
2014b756-32ed-46c1-b6a9-8ae3466045b7
Output for 5.4.31
0c5bbfe9-63d0-4aff-a25b-273458626850
Output for 5.4.30
b1756544-8d2e-4f31-a282-0aaca9fe3ace
Output for 5.4.29
9836efa6-bf1d-48f4-88b9-2c0d69d75542
Output for 5.4.28
5e0e9db7-9a4c-4919-9199-81dc4ba5384b
Output for 5.4.27
bc092052-3c12-4892-adf5-56137236e20b
Output for 5.4.26
a4177610-6914-4aa0-b8fe-24d6a60720b1
Output for 5.4.25
6f39baf9-f529-45bc-84d0-28a45d199cd4
Output for 5.4.24
b8c39dad-3882-4f46-82fe-b64918985065
Output for 5.4.23
8de4b4c0-821a-4dfb-ade3-6b05486de96e
Output for 5.4.22
bb08e396-d889-4e3c-b34c-543987d72370
Output for 5.4.21
b6c868e2-34e9-40ac-ad7d-f06c120740f3
Output for 5.4.20
fab94ef4-1cab-47e9-b789-083efa9a2aff
Output for 5.4.19
2c9f8b9b-39cc-4de3-a037-1f535d93a704
Output for 5.4.18
136a4d53-62aa-4408-9448-c886c878cf42
Output for 5.4.17
6ca5d449-7324-4e96-a571-02d8de966630
Output for 5.4.16
2974ff1d-4b08-4737-a1cc-c052e95fd0ca
Output for 5.4.15
e1ae2de4-e661-45e0-936c-0cb2c6e2fac8
Output for 5.0.0 - 5.4.14
Fatal error: Call to undefined function openssl_random_pseudo_bytes() in /in/HOmHV on line 5
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/HOmHV on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/HOmHV on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: openssl_random_pseudo_bytes() in /in/HOmHV on line 5