Shaun Posted December 11, 2007 Share Posted December 11, 2007 Hi everyone been a long time since ive been around here. anyhow I need a little help with something. suppose I have a variable $var = "-this is my var-"; how would i extract the text that is in between the "-" characters.. I am aware that I would need to use strpos() & strrpos() to do this but im really getting confused on how to actually do it. Any help would be most appreciated. Thank you! Shaun Quote Link to comment Share on other sites More sharing options...
trq Posted December 11, 2007 Share Posted December 11, 2007 <?php $var = "-this is my var-"; if (preg_match('/-(.*?)-/',$var,$m)) { echo $m[1]; } ?> Quote Link to comment Share on other sites More sharing options...
Shaun Posted December 11, 2007 Author Share Posted December 11, 2007 I COULD KISS YOU! thank you very much! Quote Link to comment 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.