3v4l.org

run code in 300+ PHP versions simultaneously
<?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
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected end of file, expecting ',' or ';' in /in/pgdUc on line 11
Process exited with code 255.

preferences:
166.59 ms | 1395 KiB | 36 Q