I've been working on a project in PHP where I need to perform some mathematical calculations. However, I'm dealing with strings instead of numbers. I was wondering if it is possible to perform mathematical operations on strings in PHP?
I have a scenario where I have a string, say "10", and I want to add another string, like "5", to it. Instead of concatenating the two strings, I want to actually perform the addition operation and get the result as "15". Is this something that can be achieved in PHP?
I tried using the addition operator on two string variables, but it seems to just concatenate them together instead of performing addition. I also attempted to typecast the strings into integers using `(int)` or `intval()`, but that didn't seem to work either.
Is there a way to accomplish mathematical operations directly on strings in PHP? Or do I need to convert the strings into numbers before performing the calculations? Any suggestions or examples would be greatly appreciated.
Thanks in advance!