数组 - 删除重复/无密钥

Trying to learn how to work with Arrays, merging (or removing duplicate). Basically this: The database will have the actual data and I have another array that will give me all the result I expected to have.

Database:

V1, V2, V5, V6, V7, V10

Custom Array:

V1, V2, V3, V4, V5, V6, V7, V8, V9, V10

I would like to have the output to tell me:

V3, V4, V8, V9

But I keep getting only V1 as the output. I must've missed some vital information somewhere.

Example code I have:

for($x = 0; $x < 1201; $x++){ $a[] = array('VFL'.$x); }
            $MFSQL = 'SELECT SCPlayer FROM SC'.$S;
                $MFSQL .= ' WHERE SCSnap = (SELECT MAX(DSSnap) FROM DataSnap WHERE DSServer = '.$S.')';
                $MFSQL .= ' AND (SCPlayer REGEXP "VFL[0-9]{1,4}")';
                $MFSQL .= ' ORDER BY SCPlayer';
            $Re = $ZD -> query($MFSQL);
            while($Ro = $ZD -> fetch_assoc($Re)){ $b[] = array($Ro['SCPlayer']); }
            $c = array_values(array_unique($a+$b));
            echo json_encode($c);

Any help/insight appreciated!

try this

$arr_database = array("V1", "V2", "V5", "V6", "V7", "V10");
$arr_custom = array("V1", "V2", "V3", "V4", "V5", "V6", "V7", "V8", "V9", "V10");

$arr_output = array_diff($arr_custom, $arr_database);

print_r($arr_output);

OUTPUT :

Array
(
    [2] => V3
    [3] => V4
    [7] => V8
    [8] => V9
)

DEMO

You can use array_diff:

$arr = array_diff($custom, $database);