maliary Posted May 31, 2007 Share Posted May 31, 2007 Hi, How would i remove the slashes from this 05/14/2006 using preg_split?? Quote Link to comment https://forums.phpfreaks.com/topic/53711-solved-preg_split/ Share on other sites More sharing options...
Wildbug Posted May 31, 2007 Share Posted May 31, 2007 // No need for regular expressions in this case: explode('/','05/14/2006'); // or str_replace('/','','05/14/2006'); // If you really, really, really want to.... preg_split('/\//','05/14/2006'); Quote Link to comment https://forums.phpfreaks.com/topic/53711-solved-preg_split/#findComment-265539 Share on other sites More sharing options...
effigy Posted May 31, 2007 Share Posted May 31, 2007 In addition to Wildbug's comment, always change your delimiters to make the expression easier to read, type, and manage: preg_split('#/#','05/14/2006'); Quote Link to comment https://forums.phpfreaks.com/topic/53711-solved-preg_split/#findComment-265543 Share on other sites More sharing options...
The Little Guy Posted June 5, 2007 Share Posted June 5, 2007 or preg_replace: <?php echo preg_replace("~/~"," ",'05/14/2006'); ?> Quote Link to comment https://forums.phpfreaks.com/topic/53711-solved-preg_split/#findComment-268521 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.