kts Posted April 3, 2008 Share Posted April 3, 2008 I have a variable that contains ## or ##_## or ##_##_## I would like to use regex to grab out if its ##_## grab both nums and define which is first and second as well as the third ##_##_## 1, 2, 3 in seperate variables or an array is this possible? Link to comment https://forums.phpfreaks.com/topic/99429-looking-for-help/ Share on other sites More sharing options...
Paperstyle Posted April 4, 2008 Share Posted April 4, 2008 You'd use preg_split, with a pattern something like /\D/ so you're splitting by non-digits. Or if there'll always be underscores separating the numbers you could use explode($yourString, '_'). Link to comment https://forums.phpfreaks.com/topic/99429-looking-for-help/#findComment-508984 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.