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

php中define带入表达式问题

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-02 11:34:03
Original
1024 people have browsed it

php

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

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

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

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

又如何处理常量呢?

谢谢

Related labels:
php
source:php.cn
Statement of this Website
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template