3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Guid { private $guid = ''; public function __construct($guid) { $this->guid = $guid; } public static function newGuid() { return new Guid('35918bc9-196d-40ea-9779-889d79b753f0'); } public function __toString() { return $this->guid; } public function toByteArray() { $str = str_replace('-', '', $this->guid); $ints = array_map('hexdec', str_split($str, 2)); // swap $newints = $ints; $newints[0] = $ints[3]; $newints[1] = $ints[2]; $newints[2] = $ints[1]; $newints[3] = $ints[0]; $newints[4] = $ints[5]; $newints[5] = $ints[4]; $newints[6] = $ints[7]; $newints[7] = $ints[6]; return implode('', array_map('chr', $newints)); } public function printBytes($bytes) { for ($i = 0; $i < strlen($bytes); $i++) { echo strtoupper(dechex(ord($bytes[$i]))).' '; } echo "\n"; } } $guid = Guid::newGuid(); $str = $guid->toByteArray(); $guid->printBytes($str);
Output for git.master, git.master_jit, rfc.property-hooks
C9 8B 91 35 6D 19 EA 40 97 79 88 9D 79 B7 53 F0

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
32.23 ms | 401 KiB | 8 Q