note 12306 deleted from function.implode by jimw
| From: | jimw@php.net | Date: | Thu, 20 Dec 2001 22:27:16 +0000 |
| Subject: | note 12306 deleted from function.implode by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23500@lists.php.net to get a copy of this message | ||
To round out the above function (associative_implode), you need to be able to retrieve imploded
associative-array. In steps associative_explode( )
######
## Begin Code
function associative_explode( $seperator, $string ) {
$return_array = array( );
$exploded = explode( $seperator, $string );
reset( $exploded );
while( list( $n, $v ) = each( $exploded ) ) {
if( !$first_equal = strpos( $v, '=' ) )
$first_equal = '';
$return_array[substr( $v, 0, $first_equal )] = substr( $v, $first_equal + 1 );
}
return $return_array;
}
######
## End Code