php - String to symbols and numbers -
this question has answer here:
is there way turn addition, subtraction, multiplication, , division symbols in string actual addition, subtraction, multiplication, , division symbols, along numbers inside string actual numbers? so, instead of symbols acting part of string, act outside of string, , same thing numbers. there function this?
$string = "1+1-1*1/1";
needed result:
$result = 1+1-1*1/1 = 1;
assuming you're outputting browser,
÷ ÷
× ×
and hope you're able figure out add , subtract on own :p
$result = "1 + 1 - 1 × 1 ÷ 1 = 1";
Comments
Post a Comment