1

If i've a string like this

((((((4,50*0,86)*52500*1,0016)+3800)/52500)*2,2046)*1,05)

how can i do the operation for obtaning the total result?

Thank You

user3684020
  • 103
  • 1
  • 9

1 Answers1

0

Maybe your question is a possible duplicate from calculate-math-expression-from-a-string-using-eval

However

if you need to store this in a variable you can do

$string='((((((4,50*0,86)*52500*1,0016)+3800)/52500)*2,2046)*1,05)';
$response=eval('return '.str_replace(',','.',$string.';'));

print($response);

the output is:

9.14027512736
Elementary
  • 1,443
  • 1
  • 7
  • 17