Editing values on a simple array

Hi everyone ;

This one is a annoying situation

I have a array, that gets feed from a web form.

like this :      "2+3+4/20"

it puts in the first element of the array

but i want it to be like this  : $a[0] = "2" , $a[1]="+".... $a[6]="20"

Now, note that the last elemet is a two digit number, so if you use this command :
$kstring = preg_split("//", $input);

it will take as a "2" and "0"

you have to find  a way arround this ...

Goodluck guys, and thanks alot!!!!

Who is Participating?
snoyes_jwConnect With a Mentor Commented:
$a = preg_split("|([-+*/])|", $input, -1, PREG_SPLIT_DELIM_CAPTURE)
cemaykanAuthor Commented:

the only operands used are (*, +, /,-) ... The rest are integer numbers...

No comment has been added to this question in more than 21 days, so it is now classified as abandoned..
I will leave the following recommendation for this question in the Cleanup topic area:
Accept: snoyes_jw {http:#13711559}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

EE Cleanup Volunteer
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.