<?php
$input = "22+2=";
$inputLength = strlen($input);
$number = 0;
$result = 0;
$op = '';
for($i=0; $i<$inputLength; $i++)
{
$char = substr($input, $i, 1); if ($char == '*' || $char == '+' || $char == '-' || $char == '=' )
{
//Что тут писать?
}
{
$number = $number*10+$char;
echo $number;
}
}
PD9waHAKCiRpbnB1dCA9ICIyMisyPSI7CiRpbnB1dExlbmd0aCA9IHN0cmxlbigkaW5wdXQpOwoKJG51bWJlciA9IDA7CiRyZXN1bHQgPSAwOwokb3AgPSAnJzsKCmZvcigkaT0wOyAkaTwkaW5wdXRMZW5ndGg7ICRpKyspCnsKICAgICRjaGFyID0gc3Vic3RyKCRpbnB1dCwgJGksIDEpOwogICAgaWYgKCRjaGFyID09ICcqJyB8fCAkY2hhciA9PSAnKycgfHwgJGNoYXIgPT0gJy0nIHx8ICRjaGFyID09ICc9JyApCiAgICB7CgkJLy/Qp9GC0L4g0YLRg9GCINC/0LjRgdCw0YLRjD8gCiAgICAgIAogICAgfQogICAgZWxzZWlmIChpc19udW1lcmljKCRjaGFyKSkKICAgIHsKICAgICAgICAkbnVtYmVyID0gJG51bWJlcioxMCskY2hhcjsKICAgICAgICBlY2hvICRudW1iZXI7CiAgICB9Cgp9Cgo=