<?php
function filter($elmnt) 
{
    if ($elmnt != "null" && $elmnt != "" && $elmnt!='---' ) {
        return $elmnt;
    }
}

$sql = $dbcon->prepare("SELECT * FROM timetable where pmp=?");
$sql->execute([$usr]);
$row1=$sql->fetch(PDO::FETCH_ASSOC);
$idx=$row1['id']+1;
$sql = $dbcon->prepare("SELECT * FROM timetable where id=?");
$sql->execute([$idx]);
$row2=$sql->fetch(PDO::FETCH_ASSOC);

$x2=array_slice($row2, 3);
$x1=array_slice($row1, 3);
$subj=array_filter($x2,"filter");
$tmim=array_filter($x1,"filter");

	$i=1;
	foreach ($subj as $s)
	{
		$ar=explode('/',$s);
		$sbj[$i]=ltrim($ar[1]);
		$i++;
	}
		$i=1;
		
	foreach ($tmim as $t)
	{
		$tm[$i]=$t."/".ltrim($sbj[$i]);
		$i++;
	}
	$sub=array_unique($sbj);
    $mathsubj=array_unique($tm);