I'm creating a script that will filter out duplicate lines from a textarea. However, I am constantly getting various "Notice: Undefined offset: 2" & other higher offsets after the script has filtered through it. I'm uncertain on how to stop the messages from appearing in the results. This is what I have so far.
<?php
$textarea = $_POST['textarea'];
$split = explode("", $textarea);
$split = array_unique($split);
$i = 0;
if (isset($_POST['submit1'])) {
$submit = $_POST['submit1'];
for ($i; $i < count($split); $i++) {
echo $split[$i];
}
}
?>