I have this pieces of php here...
The value that gets written in HTML is this $16.67
.
I am not sure what value type this is, not sure if it is a string or integar.
Regardless, I need to take this value and increase it by 3%
.
I tried this but to no avail:
<?php echo $row['display_price' * 1.03]; ?>
If someone could help me out here this would be great.
You are trying to multiple display_price
string and use it as array key and you should just increase the value that the variable holds.
echo $row['display_price'] * 1.03;
If variable holds the dollar sign too (it shouldn't!) use this regex to get the value and multiply it. Example:
echo "$" . ( floatval( preg_replace( "/[^-0-9\.]/", "", $var ) ) * 1.03 );
You need to get the float value of your variable. And then, you increase it.
$increasedValue = floatval($row['display_price']) * 1.03;
echo '$' . $increasedValue;
This will return what you want, with the dollar sign at the beginning.