PHP alike function "explode"

 

Hi,

does anyone can help me? I need PHP alike "explode" function, but it seems in MQL4 you can not return an array as a function result.

 
void StringExplode(string sDelimiter, string sExplode, string &sReturn[]){
   
   int ilBegin = -1,ilEnd = 0;
   int ilElement=0;
   while (ilEnd != -1){
      ilEnd = StringFind(sExplode, sDelimiter, ilBegin+1);
      ArrayResize(sReturn,ilElement+1);
      sReturn[ilElement] = "";     
      if (ilEnd == -1){
         if (ilBegin+1 != StringLen(sExplode)){
            sReturn[ilElement] = StringSubstr(sExplode, ilBegin+1, StringLen(sExplode));
         }
      } else { 
         if (ilBegin+1 != ilEnd){
            sReturn[ilElement] = StringSubstr(sExplode, ilBegin+1, ilEnd-ilBegin-1);
         }
      }      
      ilBegin = StringFind(sExplode, sDelimiter,ilEnd);  
      ilElement++;    
   }
}
 
string StringImplode(string sDelimiter, string sImplode[]){
   
   string slImplode = "";
   for (int i = 0; i < ArraySize(sImplode); i++) {
      slImplode = StringConcatenate(slImplode, sImplode[i], sDelimiter);
   }
   return(StringSubstr(slImplode, 0, (StringLen(slImplode) - StringLen(sDelimiter))));
}
 
string StringConcatImplode(string sDelimiterA, string sDelimiterB, string sImplodeA[], string sImplodeB[]){
   
   string slImplode = "";
   for (int i = 0; i < ArraySize(sImplodeA); i++) {
      slImplode = StringConcatenate(slImplode, sImplodeA[i], sDelimiterA, sImplodeB[i], sDelimiterB);
   }
   return(StringSubstr(slImplode, 0, (StringLen(slImplode) - StringLen(sDelimiterB))));
}
 
/*
A 65
Z 90
a 97
z 122
À 192
Þ 222
à 224
þ 254
× 215
÷ 247
*/
 
string StringToLower(string sText){   
   
   int i = 0;
   while (i < StringLen(sText)){
      int ilChar = StringGetChar(sText, i);
      if ((ilChar >= 65 && ilChar <= 90) || (ilChar >= 192 && ilChar <= 222 && ilChar != 215)){       
         sText = StringSetChar(sText, i, ilChar+32);
      }      
      i++;
   }
   return(sText);
}
 
string StringToUpper(string sText){
   
   int i = 0;
   while (i < StringLen(sText)){
      int ilChar = StringGetChar(sText, i);
      if ((ilChar >= 97 && ilChar <= 122) || (ilChar >= 224 && ilChar <= 254 && ilChar != 247)){
         sText = StringSetChar(sText, i, ilChar-32);
      }      
      i++;
   }
   return(sText);
}
hth
Reason: