3v4l.org

run code in 300+ PHP versions simultaneously
<?php $values = ['12,30', '116,10', '1.563,14']; echo array_sum( str_replace( ['.', ','], ['', '.'], $values ) ); echo "\n---\n"; $f = new NumberFormatter( 'de_DE', NumberFormatter::DECIMAL ); echo array_reduce( $values, fn($result, $v) => $result + $f->parse($v), 0 );
Output for 8.5.1 - 8.5.3
1691.54 --- Fatal error: Uncaught Error: Class "NumberFormatter" not found in /in/61H8l:15 Stack trace: #0 {main} thrown in /in/61H8l on line 15
Process exited with code 255.
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0
1691.54 --- 1691.54

preferences:
55.3 ms | 843 KiB | 4 Q