|
[تحسين] عمل explode لمتغير باستخدام اكثر من delimiter
مثال:print_r(explodeX(Array(".","!"," ","?",";"),"هذه.عبارة?عن جملة;غير صحيحة"));
function explodeX($delimiters,$string)
{
$return_array = Array($string); // The array to return
$d_count = 0;
while (isset($delimiters[$d_count])) // Loop to loop through all delimiters
{
$new_return_array = Array();
foreach($return_array as $el_to_split) // Explode all returned elements by the next delimiter
{
$put_in_new_return_array = explode($delimiters[$d_count],$el_to_split);
foreach($put_in_new_return_array as $substr) // Put all the exploded elements in array to return
{
$new_return_array[] = $substr;
}
}
$return_array = $new_return_array; // Replace the previous return array by the next version
$d_count++;
}
return $return_array; // Return the exploded elements
}
|
الموقع الآن فى الفترة التجريبية وهذا الجزء غير كامل وجارى العمل عليه، للراغبين في المساعدة برجاء التقدم

