I would first change the first array to something that is easier to check.
<?php
$temp = array();
foreach ($array1 as $val) {
$temp[$val['cid']] = $val['value'];
}
?>
Now you have an array:
$temp[1] = "red";
$temp[2] = "green";
$temp[3] = "pink";
$temp[4] = "yellow";
Then you can easily use that in the second array
<?php
$new= array();
foreach ($array2 as $key=>$val) {
$new[$key] = $temp[$val];
}
?>