3v4l.org

run code in 300+ PHP versions simultaneously
<?php $hot = array( 'hotObj 1', 'hotObj 2', 'hotObj 3', 'hotObj 4', ); $new = array( 'newObj 1', 'newObj 2', ); $count = (count($hot) > count($new)) ? count($hot) : count($new); $result = []; for($i= 0; $i < $count;$i++){ if(isset($hot[$i])){ $result[] = $hot[$i]; } if(isset($new[$i])){ $result[] = $new[$i]; } } print_r($result);

preferences:
28.8 ms | 404 KiB | 5 Q