kirill578 Posted January 14, 2011 Share Posted January 14, 2011 Is there some PHP function that can take a part of string between quotes or somthing like this and make an array out of it? Example: $string = "balal sd<asx zxcz>xc asd asd <e asd xzcz>xcv"; $array = Some_function('<','>',$string); . . . Quote Link to comment https://forums.phpfreaks.com/topic/224410-take-something-our-of-string/ Share on other sites More sharing options...
trq Posted January 14, 2011 Share Posted January 14, 2011 preg_match. Quote Link to comment https://forums.phpfreaks.com/topic/224410-take-something-our-of-string/#findComment-1159306 Share on other sites More sharing options...
kirill578 Posted January 14, 2011 Author Share Posted January 14, 2011 Is there some tutorial for these signs "|<[^>]+>(.*)</[^>]+>|U"?? Quote Link to comment https://forums.phpfreaks.com/topic/224410-take-something-our-of-string/#findComment-1159317 Share on other sites More sharing options...
salathe Posted January 14, 2011 Share Posted January 14, 2011 kirill578, read through the PHP manual section on regex patterns[1] a few times (you likely won't absorb everything in one sitting!). And keep going back to it for reference. [1] http://php.net/reference.pcre.pattern.syntax Quote Link to comment https://forums.phpfreaks.com/topic/224410-take-something-our-of-string/#findComment-1159320 Share on other sites More sharing options...
ruddie Posted January 18, 2011 Share Posted January 18, 2011 Not sure about that.. but this might str_replace($searchForThis, $replaceWithThis, $fromThis, $passSomethingHereToGiveItAmountOfReplacements); What you can do with this, is like take tags like the code tags used on this website, and replace them with things like < div > and < table >.... Not sure what you really want to achieve though, could you make it a bit clearer? The function thorpe posted should really do what you want otherwise. Quote Link to comment https://forums.phpfreaks.com/topic/224410-take-something-our-of-string/#findComment-1161230 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.