sina_nlp Posted January 2, 2015 Share Posted January 2, 2015 Hi I would like to use regex in php for this array : $strings = array("words", "test" ,"1=1");words and test is ok , but I want set 1=1 like $i=$i for any value (just numbers)2=2 or 10=10 and .... Quote Link to comment https://forums.phpfreaks.com/topic/293605-regex-in-php-array-numbers/ Share on other sites More sharing options...
Psycho Posted January 2, 2015 Share Posted January 2, 2015 Not sure which function you plan on using this with, but the RegEx for what you want would look like this: "(\d+)=\\1" Quote Link to comment https://forums.phpfreaks.com/topic/293605-regex-in-php-array-numbers/#findComment-1501547 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.