3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $guidstr = ""; for ($i=1;$i <= 16;$i++) { $b = (int)rand(0,0xff); if ($i == 7) { $b &= 0x0f; $b |= 0x40; } // version 4 (random) if ($i == 9) { $b &= 0x3f; $b |= 0x80; } // variant $guidstr .= sprintf("%02s", base_convert($b,10,16)); if ($i == 4 || $i == 6 || $i == 8 || $i == 10) { $guidstr .= '-'; } } echo $guidstr;
based on pgdUc
Output for 7.2.6
eb92024c-1949-4a11-91c9-adab0d2b28c6
Output for 7.2.0
ceb81238-ef95-420e-b102-e06634012ceb
Output for 7.1.10
6de8702b-a531-47cc-a0dd-a0f8839c3487
Output for 7.1.7
1c049d9f-34e8-4c3d-97ac-0a388c6bdc3f
Output for 7.1.6
b5951f60-16c0-4992-b41c-f7572264f34f
Output for 7.1.5
d5649783-e26d-4a15-88c5-2e44203a3d8f
Output for 7.1.4
b086abd5-8595-4354-8153-4f1e67ad6751
Output for 7.1.3
2967b798-ee3c-4b91-ac73-ba5beff94573
Output for 7.1.2
b06c3c84-773c-49a0-8f5b-d776d3757c17
Output for 7.1.1
483e1357-a8ba-438b-bb6f-830f085929e9
Output for 7.1.0
231a5823-b027-46de-a047-81282eef7e83
Output for 7.0.20
2d9f5a27-d914-41fc-8d98-8207205f87e0
Output for 7.0.19
4d71739c-fd29-449b-a34a-3d5eacf23d32
Output for 7.0.18
c5f73288-013b-4437-88a6-5895e2fe5c90
Output for 7.0.17
d352b7d3-578a-457e-a75a-b8701d46a6f7
Output for 7.0.16
54c98ca4-73cd-4185-8178-6a6a73701050
Output for 7.0.15
23c256d1-baa5-4f76-904b-866517a51910
Output for 7.0.14
5b29d6cd-ce5d-499e-a13c-8b0c636ea7df
Output for 7.0.13
b884d40b-56a2-49de-aa18-93dda22d9856
Output for 7.0.12
15db1dbf-1a34-47c7-b5a7-04b7acb61251
Output for 7.0.11
dd263611-1b95-449c-b81e-802f446056ff
Output for 7.0.10
ed341501-7150-4fee-8afa-3726c4aaf8ef
Output for 7.0.9
94b37157-2c02-46f7-8de9-0dc34434451b
Output for 7.0.8
9b9a45ce-9ccb-4052-b41f-2dd5c6ae4503
Output for 7.0.7
0c0a29d8-8022-4657-be51-2caed130b5ff
Output for 7.0.6
69f8e4c1-f2f8-4676-ada4-6c35ad7b3a51
Output for 7.0.5
d79b35ee-5dc9-4c1c-92de-428710803463
Output for 7.0.4
87728c8b-2911-402b-8de5-6f1ded398781
Output for 7.0.3
4aa71a18-1534-46d7-a968-09e87b30231d
Output for 7.0.2
11295099-a75b-4438-81b2-ca810cf13600
Output for 7.0.1
abcac531-9dce-405e-ba58-f11c265556d1
Output for 7.0.0
4993abfb-a96b-48a4-9c8e-cf86174090e4
Output for hhvm-3.15.4
ff1874e3-18a8-4d02-af06-ea88bff09bc1
Output for 5.6.30
624f9649-88a2-4a06-a7d0-3d437a33d9bd
Output for 5.6.29
77ee505f-942d-4df2-b7c7-450d87c1a722
Output for 5.6.28
ba4bb4df-0ef9-4246-bf1c-84960089c633
Output for 5.6.27
4e8c43d7-1d52-4dc6-aef2-bbb0c1423178
Output for 5.6.26
a6789ffa-4238-4eea-80f3-0ed74b800fb1
Output for 5.6.25
b4e32331-f6ac-4102-b672-ac3336ccc595
Output for 5.6.24
1cf1e9ae-f6b2-4b14-af36-36710680050d
Output for 5.6.23
fe568369-8761-40f4-96aa-1d9d05232dc3
Output for 5.6.22
96e3e6b5-2a93-4a81-ae2c-4f37e0ebfd83
Output for 5.6.21
86f29f7a-3583-450e-a158-6a9be7ffd699
Output for 5.6.20
fc700179-9571-4acc-bb21-52371b83e924
Output for 5.6.19
bcb1c8c9-a7b6-4009-ad0e-ca7b9ee8b6c9
Output for 5.6.18
4c9b43da-1832-4bb3-813b-09504216903f
Output for 5.6.17
32ab71d9-cc10-47f1-a70e-ab4a1c38f745
Output for 5.6.16
a85034ab-f3ef-4f39-9938-bfc0b4513531
Output for 5.6.15
ba392a5d-d0b4-4c1c-8580-7b23cb56c5e0
Output for 5.6.14
ab5e8259-8248-429a-bcc8-1ccf4481f592
Output for 5.6.13
1f05430f-511e-4466-93c4-b9c101292119
Output for 5.6.12
b8cbaa38-cd0d-43a3-bc14-fa40b0f8d2d3
Output for 5.6.11
f3664945-1124-4fe0-90f7-bebe4533f795
Output for 5.6.10
d66e3cdb-f3db-48b4-8a57-b6849e3b008b
Output for 5.6.9
53414fe2-71dd-402b-bdd8-46e6c39b037a
Output for 5.6.8
85d2e874-fa24-4c90-8ab7-53f617029360
Output for 5.6.7
02d1b72c-11c4-4c0b-a996-99978b6c1556
Output for 5.6.6
84595428-85d1-402b-bd0c-65bf984e3ca7
Output for 5.6.5
98c6648a-2176-450c-b092-01a4bb2493f5
Output for 5.6.4
7a613563-25e3-4a45-a27e-468b541b2316
Output for 5.6.3
4c89155c-eaa7-4941-a9a1-9c194177b9a6
Output for 5.6.2
425a64a8-b66b-4da9-b60c-b8276d5b03e4
Output for 5.6.1
87c1143c-b76b-47af-8d28-cf7b6d1d86c2
Output for 5.6.0
29341763-5ee1-4e76-a1ea-057b3e9d51a5