funsutton Posted August 31, 2008 Author Share Posted August 31, 2008 I actually didn't see the difference, so I switched it out. Thanks man. Link to comment https://forums.phpfreaks.com/topic/121949-solved-extracting-numbers-coverting-and-replacing-them-in-a-string/page/2/#findComment-630132 Share on other sites More sharing options...
DarkWater Posted August 31, 2008 Share Posted August 31, 2008 No problem. Link to comment https://forums.phpfreaks.com/topic/121949-solved-extracting-numbers-coverting-and-replacing-them-in-a-string/page/2/#findComment-630134 Share on other sites More sharing options...
funsutton Posted August 31, 2008 Author Share Posted August 31, 2008 Hey, here is a separate string, similar to the other, however it has no F or C to denote the actual temperatures. How hard would it be to modify your preg_replace to only change the ones that are temps...and not the ones that are actual dates and times? mpdData['HMhour'].hour['0']=new mpdHMHrObj(new Date('2008','7','31','0','0','0'),'11','Few Showers','74','74','30','69','87','From S 2 mph'); The trick is, in this section "'Few Showers','74','74','30','69','87','From S 2 mph'", only the 74,74,69 are temps, and the others are percents. Link to comment https://forums.phpfreaks.com/topic/121949-solved-extracting-numbers-coverting-and-replacing-them-in-a-string/page/2/#findComment-630135 Share on other sites More sharing options...
DarkWater Posted August 31, 2008 Share Posted August 31, 2008 See, the thing is that there's nothing special to denote those numbers as temperatures. I mean, you could write up a long-winded regex for every single field until you get the right ones, but I doubt you'd want to do that... @_@ Link to comment https://forums.phpfreaks.com/topic/121949-solved-extracting-numbers-coverting-and-replacing-them-in-a-string/page/2/#findComment-630330 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.