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?? 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'); 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'); 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'); ?> Link to comment https://forums.phpfreaks.com/topic/53711-solved-preg_split/#findComment-268521 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.