Skip to content

Commit 325e0ef

Browse files
committed
Merge branch 'master' of github.com:pangudashu/php7-internal
2 parents 31f60c1 + ee6b85b commit 325e0ef

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

2/zval.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ $b = 1;
1313

1414
### 2.1.1 变量的基础结构
1515
```c
16-
//zend_type.h
16+
//zend_types.h
1717
typedef struct _zval_struct zval;
1818

1919
typedef union _zend_value {
@@ -259,7 +259,7 @@ $a,$b -> zend_string_1(refcount=0,val="hi~")
259259
|reference | Y |
260260
```
261261
simple types很显然用不到,不再解释,string、array、object、resource、reference有引用计数机制也很容易理解,下面具体解释下另外两个特殊的类型:
262-
* __interned string:__ 内部字符串,这是种什么类型?我们在PHP中写的所有字符都可以认为是这种类型,比如function name、class name、variable name、静态字符串等等,我们这样定义:`$a = "hi~;"`后面的字符串内容是唯一不变的,这些字符串等同于C语言中定义在静态变量区的字符串:`char *a = "hi~";`,这些字符串的生命周期为request期间,request完成后会统一销毁释放,自然也就无需在运行期间通过引用计数管理内存。
262+
* __interned string:__ 内部字符串,这是种什么类型?我们在PHP中写的所有字符都可以认为是这种类型,比如function name、class name、variable name、静态字符串等等,我们这样定义:`$a = "hi~";`后面的字符串内容是唯一不变的,这些字符串等同于C语言中定义在静态变量区的字符串:`char *a = "hi~";`,这些字符串的生命周期为request期间,request完成后会统一销毁释放,自然也就无需在运行期间通过引用计数管理内存。
263263

264264
* __immutable array:__ 只有在用opcache的时候才会用到这种类型,不清楚具体实现,暂时忽略。
265265

0 commit comments

Comments
 (0)