note 70427 deleted from ref.array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
Note Submitter: r2rien at gmail dot com 

----

Regarding the string to array (parse_array) function posted by Kevin Law(thanks) and urlencoded by vinaur(thanks) ,
The function will not work correctly if you use integer values as keys.
Thus I exchanged array_merge with a simple combined operator.

For example dealing with 4digit year strings as keys; parse_array(2006:abc,B:bcd) will produce

=> with array_merge:
<?php //...
$result = array_merge($result, parse_line2array(substr($line,$comma_pos+1)));
//...
$result = array_merge($result, parse_line2array($line));
//... ?>
Array (
    [0] => abc
    [B] => bcd
)

=> with combined operator:
<?php //...
$result += parse_line2array(substr($line,$comma_pos+1));
//...
$result += parse_line2array($line);
//... ?>
Array
(
    [2006] => abc
    [B] => bcd
)
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.