- print_r: documentation ( source)
<?php
$hot = array(
'hotObj 1',
'hotObj 2',
'hotObj 3',
'hotObj 4',
);
$new = array(
'newObj 1',
'newObj 2',
);
$result = [];
foreach ($hot as $key => $value) {
$result[] = $value;
if(isset($new[$key])){
$result[] = $new[$key];
}
}
print_r($result);