Home >Backend Development >PHP Tutorial >php中define带入表达式问题

php中define带入表达式问题

WBOY
WBOYOriginal
2016-06-02 11:34:03996browse

php

<code>define('GW_MAXFILESIZE', '32768*10');echo GW_MAXFILESIZE/1;</code>

为什么输出是32768而不是327680呢?
读书少……

一个猜想,php不像C是原样替换,先发生了类型转换,遇到「*」号就直接忽略后面的了。

若如此,那么
define('GW_MAXFILESIZE', '32768*10');
if(GW_MAXFILESIZE>0) {
//whatever
}

又如何处理常量呢?

谢谢

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn