How PHP handle const value
| From: | bug zhu | Date: | Fri, 28 Oct 2011 09:46:47 +0000 |
| Subject: | How PHP handle const value | ||
| Groups: | php.pecl.dev | ||
| Request: | Send a blank email to pecl-dev+get-8779@lists.php.net to get a copy of this message | ||
dear all:
today i want to find how php make a variable can't change, so i write a
test sample as follow:
<?php
const NAME = 'name';
echo NAME;
then i use vld dump the opcode:
line # * op fetch ext return
operands
---------------------------------------------------------------------------------
2 0 > ZEND_START_NAMESPACE
'NAME', 'bug'
3 1 FETCH_CONSTANT ~0
'NAME'
2 ECHO ~0
4 3 > RETURN 1
but i can't fine the ZEND_START_NAMESPACE's op_hander in the php source
directory.(i use grep commond search)
who could tell me where the ZEND_START_NAMESPACE define or how php make a
variable can't change in internal.
thanks~