<?php
$notif_estructura = array();
$i = 0;
$existe = false;

$notif->tipo = 5;
$notif->autor_id = 45;

$notif_estructura[0]->tipo = 3;
$notif_estructura[0]->autor_id = 23;

$notif_estructura[1]->tipo = 4;
$notif_estructura[1]->autor_id = 34;

$notif_estructura[2]->tipo = 6;
$notif_estructura[2]->autor_id = 21;

for ($i = 0, $limite = count ($notif_estructura); $i < $limite; $i++){
    if ($notif->autor_id == $notif_estructura[$i]->autor_id) {
		$existe = true;
		break;
    }  
    $nuevoIndice = $i;
}

$nuevoIndice++;

if (!$existe) {
	$notif_estructura[$nuevoIndice]->tipo = $notif->tipo;
	$notif_estructura[$nuevoIndice]->autor_id = $notif->autor_id;
}

for ($i = 0, $limite = count ($notif_estructura); $i < $limite; $i++){
	echo "Tipo: " . $notif_estructura[$i]->tipo . "\r\n";
	echo "Autor: " . $notif_estructura[$i]->autor_id . "\r\n\r\n";
}
?>