note 98135 added to function.explode

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Sometimes you need to explode a string by different delimiters. In that case you can use this function:

<?php
print_r(explodeX(Array(".","!"," ","?",";"),"This.sentence?contains wrong;characters"));
// Returns:
// Array("This","sentence","contains","wrong","characters")

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
}
?>
----
Server IP: 91.199.167.223
Probable Submitter: 24.132.231.93
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit        -- https://master.php.net/note/edit/98135
Del: integrated  -- https://master.php.net/note/delete/98135/integrated
Del: useless     -- https://master.php.net/note/delete/98135/useless
Del: bad code    -- https://master.php.net/note/delete/98135/bad+code
Del: spam        -- https://master.php.net/note/delete/98135/spam
Del: non-english -- https://master.php.net/note/delete/98135/non-english
Del: in docs     -- https://master.php.net/note/delete/98135/in+docs
Del: other reasons-- https://master.php.net/note/delete/98135
Reject      -- https://master.php.net/note/reject/98135
Search      -- https://master.php.net/manage/user-notes.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.