I have a string like this: x+1=13-x
What I have to do, is separate the unknown (x) from mathematical symbols (+, -, *, : or /) and numbers. That means that the left side of the string would be an array like [x,+,1] and the right side: [13,-,x].
Before this, I was only working with one-digit numbers, so, I just used str_split() function, but, now I would like to use RegEx which I am not good at.
You’ll need to adapt this a bit, but try this:
As you can see, the individual components are visible in the resulting array. You’ll need to take care of whitespace issues.