3v4l.org

run code in 300+ PHP versions simultaneously
<?php function koap2digit($koap){ $o = array('#[^\d.]#','\.\.'); $n = array('','.'); $digits = preg_replace($o, $n, $koap); $ar = explode('.', $digits); $r = 1000000; $num = 0; foreach($ar as $k => $v) { if($k == 0)$num = $v*100; elseif($k == 1) { $num = ($num+$v)*$r; } else { $num += $v*($r/100); } } return $num; } echo koap2digit('12.21.1 ч.1.1');
Output for git.master, git.master_jit, rfc.property-hooks
Warning: preg_replace(): Delimiter must not be alphanumeric, backslash, or NUL in /in/Bnius on line 5 Deprecated: explode(): Passing null to parameter #2 ($string) of type string is deprecated in /in/Bnius on line 6 Fatal error: Uncaught TypeError: Unsupported operand types: string * int in /in/Bnius:11 Stack trace: #0 /in/Bnius(24): koap2digit('12.21.1 \xD1\x87.1.1') #1 {main} thrown in /in/Bnius on line 11
Process exited with code 255.

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.05 ms | 402 KiB | 8 Q