Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $stringim = "[ayrac1]elma[/ayrac1][ayrac2]armut[/ayrac2][ayrac1]muz[/ayrac1][ayrac2]kiraz[/ayrac2]";
- $string_arr = ikiStringArasiniAl($stringim,"[ayrac1]","[/ayrac1]");
- foreach($string_arr as $string_val)
- {
- echo $string_val." ";
- }
- function ikiStringArasiniAl($myStr, $startStr, $endStr)
- {
- $myArr = explode($endStr,$myStr);
- foreach($myArr as $myVal)
- {
- $myVal = $myVal."[endOfString]";
- $returnArr[] = BetweenStr($myVal,$startStr,'[endOfString]');
- }
- return $returnArr;
- }
- function BetweenStr($InputString, $StartStr, $EndStr=0, $StartLoc=0) {
- if (($StartLoc = strpos($InputString, $StartStr, $StartLoc)) === false) { return; }
- $StartLoc += strlen($StartStr);
- if (!$EndStr) { $EndStr = $StartStr; }
- if (!$EndLoc = strpos($InputString, $EndStr, $StartLoc)) { return; }
- return substr($InputString, $StartLoc, ($EndLoc-$StartLoc));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement