两个$ this-> request-> data。 如何将它们相乘?

How do I multiply

$this->request->data['RecordDrugUnit']['dose']
*
$this->request->data['Unit']['conversion']

I am trying to store my unit dose values relatively, so in my Units table I have a conversion field which is a number relative to the unit. I get the 'dose' from a form. And this function is inside my controllers 'add' function for that form.

Your values will be strings, so first convert the values to numeric data types, then use the multiplication operator (*).

Assuming your values are integers, you can do

$product = (int)$this->request->data['RecordDrugUnit']['dose'] * (int)$this->request->data['Unit']['conversion'];

Substitute (int) for the type conversion that is appropriate in your situation.