PHP - Moved: Regular Expression For 4 Digit Number With Two Decimal Places
This topic has been moved to PHP Regex.
http://www.phpfreaks.com/forums/index.php?topic=311051.0 Similar TutorialsThis topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=315144.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=312614.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=325429.0 This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=316160.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=306546.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=317585.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=310676.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=349184.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=334308.0 This topic has been moved to MySQL Help. http://www.phpfreaks.com/forums/index.php?topic=318398.0 This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=351154.0 Hi, I'm trying to force 2 decimal places with the following function but it 's not working. Any suggestions? Code: [Select] function ShippingCost() { $shippingCost = 4.00; number_format($shippingCost,2); return $shippingCost; } Hey, just wondering what would be the best way of adding .1 to a string. For example: Code: [Select] $newversion = $currentversion + '0.0.1'; $newversion is taken from a db, lets say for this example it is 0.2.1 This code simply outputs 0.2 Any ideas? Thanks =) i am echoing out a value which is 1.2900 but i want it to echo out 1.29 how do i do this? cheers matt Hi.. I encountered problem in rounding of numbers into two decimal places. here is my sample code: if($W4_STATUS == 1 AND $DEPENDENTS == 0 AND $TotEarn >= 7917 AND $TotEarn <= 12500) { $TAX = ($TotEarn - 7917); $TAX = (937.50 + ($TAX * .25)); $TAX = number_format($TAX, 2, '.', ''); } for example from this: $TAX = ($TotEarn - 7917); $TAX = (937.50 + ($TAX * .25)); the output is: 1417.615 using this: $TAX = number_format($TAX, 2, '.', ''); the output was : 1417.61 but it should be : 1417.62 Thank you Bascially i add a couple numbers up and display the sum. sometimes the number is something like this: 234.237 i want it to display : 234.24 i realize its needs "round()" in it but i dont know how to use it.. any help? Hi I am using Zen-Cart to which I have made significant changes. Two years ago I managed to change the Products Sort Order from Integer to Decimal(5,2) to store books such as 1, 1.5, 1.75, 2 etc. Regrettably we had a major server issue and I also lost the new coding. Having restored everything else whenever we enter a book series number such as 1.5 it only stores as 1. To date the zen-Cart forums have been unable to offer a solution so I am reaching out to see if anyone else can advise me of how to get this working again please.
Thanks in advance Owen
This topic has been moved to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=358363.0 I know this should be easy.... However, to validate a 7-digit phone number, I wrote this: Code: [Select] <?php if(!empty($_POST['mobile_number'])) { if(!is_numeric($_POST['mobile_number']) || strlen($_POST['mobile_number']) != 7) { $errors[] = 'Please enter a 7-digit number without spaces or dashes for your <strong>Mobile</strong>.'; } else { $_SESSION['mobile_number'] = $_POST['mobile_number']; } } else { $_SESSION['mobile_number'] = ''; } ... but now I realise that numeric/integer validation won't work because where I am - in Ireland - mobile numbers can start with an initial zero, too. So, the following mobile numbers are possible: 0123456 0224466 How can I ensure that: each digit in the mobile number is numeric an initial zero is possible there are exactly 7 digits I suppose I loop through each digit, ensuring that that digit is numeric and break out of the loop if a non-numeric digit is encountered..? Any suggestions? TIA |