Level 32
$merge = $array01+$newpool;
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Why is this merge not acting the way I think it should? Code:
$newpool = array();
$newpool = array_add($newpool, 22, '1');
/// Vardump $newpool
/// array(1) { [22]=> string(1) "1" }
$array01 = Input::get('pool_ids');
/// Vardump $array01
/// array(2) { [125]=> string(1) "1" [126]=> string(1) "1" }
$merge = array_merge($array01,$newpool);
//vardump $merge
//array(3) { [0]=> string(1) "1" [1]=> string(1) "1" [2]=> string(1) "1" }
The result I am trying to get is:
array(3) { [125]=> string(1) "1" [126]=> string(1) "1" [22]=> string(1) "1" }
$merge = $array01+$newpool;
Please or to participate in this conversation.