I have two Arrays:
$a1=array("Maths","English","Science","ICT");
$a2=array("Maths","ICT");
I want to compare $a1 with $a2, then return
$a3=array("Maths",",,",",,","ICT");
So replace the missing values in $a2 with ",,"
This is my meager attempt :(
$a1=array("Maths","English","Science","ICT");
$a2=array("Maths","ICT");
$result = array_diff($a1, $a2);
foreach ($result as $v){
$a3 = str_replace($v, ",,", $a1);
}
print_r($a3);