3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dec_to_hex($dec) { $sign = ""; // suppress errors if( $dec < 0){ $sign = "-"; $dec = abs($dec); } $hex = Array( 0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9, 10 => 'a', 11 => 'b', 12 => 'c', 13 => 'd', 14 => 'e', 15 => 'f' ); do { $h = $hex[($dec%16)] . $h; $dec /= 16; } while( $dec >= 1 ); return $sign . $h; } function dec2hex($number) { $number = strval($number); $hexvalues = array( '0','1','2','3','4','5','6','7', '8','9','A','B','C','D','E','F' ); $hexval = ''; while($number != '0') { $hexval = $hexvalues[bcmod($number, '16')] . $hexval; $number = bcdiv($number, '16', 0); } return $hexval; } $id = 14910855968770314426; var_dump($id); $guid = dec_to_hex($id); var_dump($guid);
Output for git.master, git.master_jit, rfc.property-hooks
float(1.4910855968770314E+19) Deprecated: Implicit conversion from float 1.4910855968770314E+19 to int loses precision in /in/mqu5P on line 15 Warning: Undefined variable $h in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 227521605968785.3 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 14220100373049.082 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 888756273315.5676 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 55547267082.22298 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 3471704192.638936 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 216981512.0399335 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 13561344.502495844 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 847584.0314059902 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 52974.00196287439 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 3310.8751226796494 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 206.9296951674781 to int loses precision in /in/mqu5P on line 15 Deprecated: Implicit conversion from float 12.93310594796738 to int loses precision in /in/mqu5P on line 15 string(16) "ceee0080a3915000"

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:
55.82 ms | 405 KiB | 8 Q