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;

preferences:
57.81 ms | 1566 KiB | 5 Q