well the code that you gave treat only as a value not evaluate as a php
the simpler code for this "and i want" is
$data="M";
$filed="M";
$value =" $data==$filed ";
basically we have if then else to compare two strings
eg: if ($data==$filed) echo "yes"; else echo "no";
now the comparison is in the variable $value which is ($value=" $data== $filed". Since the queries that im building is too big and there is a if then else . This if then else compose of many comparisons. the comparison coming from the table.
now I use eval to treat the variable $value not as a value but as a php
if (eval($value)) should be the same as if ($data==$filed)