if you have a cookie whose name is mycookie[myindex2] and mycookie[myindex1] this function will delete all of them. I used "for" loops because I am used to them. A while/list would be prettier though.
<?php
// This is pretty simple. There are no arguments.
// Once this function is finished the string $final