Merge pull request #292 from git-zjx/patch-4

ord 判断问题
This commit is contained in:
wangzheng0822 2019-04-11 16:06:36 +08:00 committed by GitHub
commit 281c748755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -13,7 +13,7 @@ function expression($str)
$operStack[] = NULL;
for ($i = 0; $i < count($arr); $i++){
if (ord($arr[$i]) >= 48 && ord($arr[$i] <= 57)){
if (ord($arr[$i]) >= 48 && ord($arr[$i]) <= 57){
array_push($numStack, $arr[$i]);
continue;
}
@ -85,4 +85,4 @@ function compute(&$numStack, &$operStack){
}
expression('-1+2-(1+2*3)');
echo PHP_EOL;
eval('echo -1+2-(1+2*3);');
eval('echo -1+2-(1+2*3);');