I've got a value I'm grabbing a price range through preg-match from an external page.
I take the value, and then split it into two pieces with explode, and then I split the value again using with list. (code below).
When I look at the output, it looks like both values are numbers, but running is_numeric returns only the 2nd number as being a number.
I've tried using settype, but no luck.
How can i get this number to work?
The really strange part is that the second value is returned as a number, its only the first one that isn't.
I take the value, and then split it into two pieces with explode, and then I split the value again using with list. (code below).
When I look at the output, it looks like both values are numbers, but running is_numeric returns only the 2nd number as being a number.
I've tried using settype, but no luck.
How can i get this number to work?
Code:
if(strstr($showData[3], "$")){ $prices=explode("</td><td>", $showData[3]); list($low, $high)=split('-', $prices[0]); $low=addslashes(str_replace('$', '', $low)); $high=addslashes(str_replace('$', '', $high)); $low=addslashes(trim($low)); $high=addslashes(trim($high)); if(!is_numeric($low)){ echo "low price is not a number<br/>"; settype($low, "integer"); } if(!is_numeric($high)){ echo "high price is not a number<br/>"; } echo "$low, $high <br/>";
Comment