phpuser3 Posted July 2, 2008 Share Posted July 2, 2008 I'm new to PHP. Could anyone explain what the below code does? # time zones $pattern[] = "/(\d) (\wst\b)|(\d) (\wt\b)|(\d) (gmt\b)|(\d *\wm) (\wst\w*)| (\d *\wm) (\wt\b)|(\d *\wm) (gmt\b)/e"; $replacement[] = "'$1$3$5$7$9$11 '.strtoupper('$2$4$6$8$10$12')"; Quote Link to comment https://forums.phpfreaks.com/topic/112926-regular-expressions/ Share on other sites More sharing options...
effigy Posted July 2, 2008 Share Posted July 2, 2008 Do you have samples of the input and output data? I believe it's doing nothing more than uppercasing the time zone, but it's nasty and inefficient. Quote Link to comment https://forums.phpfreaks.com/topic/112926-regular-expressions/#findComment-580083 Share on other sites More sharing options...
phpuser3 Posted July 2, 2008 Author Share Posted July 2, 2008 Nope, I don't have the output.... I think this code takes into consideration the below options: gmt, est, ist, am, pm,...etc... I was wondering what the $1 $2 etc values were.... Quote Link to comment https://forums.phpfreaks.com/topic/112926-regular-expressions/#findComment-580087 Share on other sites More sharing options...
effigy Posted July 2, 2008 Share Posted July 2, 2008 They correspond to the pairs of parentheses, which are used to capture data. Quote Link to comment https://forums.phpfreaks.com/topic/112926-regular-expressions/#findComment-580135 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.