Michdd Posted May 27, 2009 Share Posted May 27, 2009 I need a way to get what's inside something and set it to a variable so I can use it. Ex: Then being able to get what's inside that (8949) into a variable so I can use it. Link to comment https://forums.phpfreaks.com/topic/159795-solved-string-working/ Share on other sites More sharing options...
Maq Posted May 27, 2009 Share Posted May 27, 2009 Something like this? $s= "[img=8949]"; preg_match_all("~\[img=(\d+)\]~i", $s, $matches); print_r($matches[1]); ?> Link to comment https://forums.phpfreaks.com/topic/159795-solved-string-working/#findComment-842815 Share on other sites More sharing options...
Michdd Posted May 27, 2009 Author Share Posted May 27, 2009 Works great, thanks. I really should study up on regex x.x Link to comment https://forums.phpfreaks.com/topic/159795-solved-string-working/#findComment-842817 Share on other sites More sharing options...
Maq Posted May 27, 2009 Share Posted May 27, 2009 Works great, thanks. I really should study up on regex x.x Yeah regex has saved my ass a couple times. It's definitely a good tool to have in your belt. Link to comment https://forums.phpfreaks.com/topic/159795-solved-string-working/#findComment-842819 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.