3v4l.org

run code in 300+ PHP versions simultaneously
<?php function strtod($hex) { preg_match('#([\da-f]+)\.?([\da-f]*)p#i', $hex, $parts); $i = 0; $fractional_part = array_reduce(str_split($parts[2]), function($sum, $part) use (&$i) { $sum += hexdec($part) * pow(16, --$i); return $sum; }); $decimal = (hexdec($parts[1]) + $fractional_part) * pow(2, array_pop(explode('+', $hex))); return $decimal; } $data = '406429c28f5c28f6'; $num = strtod($data); var_dump($num);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Undefined array key 2 in /in/p0Hi7 on line 6 Deprecated: str_split(): Passing null to parameter #1 ($string) of type string is deprecated in /in/p0Hi7 on line 6 Warning: Undefined array key 1 in /in/p0Hi7 on line 12 Deprecated: hexdec(): Passing null to parameter #1 ($hex_string) of type string is deprecated in /in/p0Hi7 on line 12 Notice: Only variables should be passed by reference in /in/p0Hi7 on line 12 Warning: A non-numeric value encountered in /in/p0Hi7 on line 12 float(NAN)

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:
51.4 ms | 402 KiB | 8 Q