Curses: array_merge_recursive doesn't behave as hoped, it creates arrays for matching strings
The PHP function http://us3.php.net/array_merge_recursive doesn't do what I'd hoped. Instead of merely combining nested arrays if it finds them, it creates arrays for values with matching strings.
In the output below uid and biblio_type should be a single, the last-added, value, not an array of a couple values.
<?php
stdClass::__set_state(array(
'type' => 'biblio',
'uid' =>
array (
0 => 1,
1 => '160',
),
'status' => true,
'promote' => false,
'moderate' => false,
'sticky' => false,
'format' => 0,
'comment' => 0,
'taxonomy' =>
array (
),
'biblio_type' =>
array (
0 => 129,
1 => 102,
),
'title' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_citekey' => NULL,
'biblio_contributors' =>
array (
1 =>
array (
),
),
'biblio_date' => '1973 Mar 29',
'biblio_year' => '1973',
'biblio_secondary_title' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_alternate_title' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_volume' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_issue' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_issn' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_pages' =>
SimpleXMLElement::__set_state(array(
)),
'biblio_abst_e' => NULL,
'biblio_url' => '',
'biblio_custom1' => 'http://www.ncbi.nlm.nih.gov/pubmed/?dopt=Abstract',
))
?>
http://us3.php.net/array_merge does what is desired for these. But that won't merge the taxonomy array recursively, I don't think.
While complaining about little annoyances, what the heck is with the Simple XML Element object deal rather than showing up in var_export as the string it ultimately really is?
Comments
Post new comment