3v4l.org

run code in 300+ PHP versions simultaneously
<?php $rate1 = 0.02; $var = sprintf("%.2f",1260); echo $var,"\n\n"; $product = $var * $rate1; var_dump("product: $product); // two ways to format $product echo number_format( $product, 2),"\n"; echo printf("%.2f",$product);
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected '\' (T_NS_SEPARATOR), expecting ',' or ')' in /in/o7Bea on line 11
Process exited with code 255.

preferences:
163.68 ms | 1395 KiB | 36 Q