3v4l.org

run code in 500+ PHP versions simultaneously
<?php $isSubmitted = true; $_POST['squareFoot'] = 500.5; $squareFoot = $_POST['squareFoot']; $squareFoot = filter_var($squareFoot, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_FRACTION); $squareFoot = filter_var($squareFoot, FILTER_SANITIZE_NUMBER_FLOAT, FILTER_FLAG_ALLOW_THOUSAND); $squareFoot = filter_var($squareFoot, FILTER_SANITIZE_SPECIAL_CHARS); echo $squareFoot; echo "\n"; if(!is_numeric($squareFoot)){ $isValid = false; $squareFootError = "Please enter a numeric value"; } else if(empty($squareFoot)){ $isValid = false; $squareFootError = "Please enter a numeric value"; } else if($squareFoot < 200){ $isValid = false; $squareFootError = "Please enter a number between 200 and 500,000"; } else if($squareFoot > 500000){ $isValid = false; $squareFootError = "Please enter a number between 200 and 500,000"; } else{ $squareFootFormat = number_format($squareFoot, 0, '', ','); } echo $squareFootFormat;
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.6 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
5005 5,005

preferences:
106.92 ms | 1565 KiB | 4 Q