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); . . . 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. 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"?? 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 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. 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
Archived
This topic is now archived and is closed to further replies.