<?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 " ;
}
?>
PD9waHAKJG5vdGlmX2VzdHJ1Y3R1cmEgPSBhcnJheSgpOwokaSA9IDA7CiRleGlzdGUgPSBmYWxzZTsKCiRub3RpZi0+dGlwbyA9IDU7CiRub3RpZi0+YXV0b3JfaWQgPSA0NTsKCiRub3RpZl9lc3RydWN0dXJhWzBdLT50aXBvID0gMzsKJG5vdGlmX2VzdHJ1Y3R1cmFbMF0tPmF1dG9yX2lkID0gMjM7Cgokbm90aWZfZXN0cnVjdHVyYVsxXS0+dGlwbyA9IDQ7CiRub3RpZl9lc3RydWN0dXJhWzFdLT5hdXRvcl9pZCA9IDM0OwoKJG5vdGlmX2VzdHJ1Y3R1cmFbMl0tPnRpcG8gPSA2Owokbm90aWZfZXN0cnVjdHVyYVsyXS0+YXV0b3JfaWQgPSAyMTsKCmZvciAoJGkgPSAwLCAkbGltaXRlID0gY291bnQgKCRub3RpZl9lc3RydWN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