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

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -