I have a script that I am using to compare values input values, to see if they are different. If they are then I want to perform the replace functions.
I am having an issue with numbers that have a preceding 0 on them, such as a 12 digit UPC code. Here is my code snippet:
if (trim($HTTP_POST_VARS['product_new_upc'][$id]) != trim($HTTP_POST_VARS['product_old_upc'][$id]))
If the old number was 79340242319 and the new number needs to be 079340242319 the code is not recognizing that there is a difference and not initiating the update to the database field. I have tried other combinations of number and character changes, but it only seems to happen with the preceding zero
The manual on the PHP website for trim() doesn't say anything about trimming out the preceding 0 by default.
Is there anything in this function that might be causing this? If so, is there a way around it?