Wouldn't you just get the values for R, G and B as integers for both colours you wanna mix, and take half way between both R's, half way between both G's and half way between both B's? Like for instance:
$color1 = array ( 50, 100, 255);
$color2 = array ( 100, 200, 50);
$color3[0] = round (($color1[0] + $color2[0]) / 2);
$color3[1] = round (($color1[1] + $color2[1]) / 2);
$color3[2] = round (($color1[2] + $color2[2]) / 2);
where $color1 and $color2 hold the 3 values of the 2 colours you're mixing, and $color3 is the mixed colour. Hope that helps 🙂