- 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) {
$value[] = $value;
if(isset($new[$key])){
$value[] = $new[$key];
}
}
print_r($hot);