You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
__halt_compiler(); the file data which will be ignored by the Engine
139
139
```
140
140
141
-
##The Memory Model
142
-
###General
141
+
##The Memory Model
142
+
###General
143
143
This section and those immediately following it describe the abstract
144
144
memory model used by PHP for storing variables. A conforming
145
145
implementation may use whatever approach is desired as long as from any
@@ -258,7 +258,7 @@ of which (except `unset`) use the & punctuator:
258
258
-[byRef variable-use list in an anonymous function](10-expressions.md#anonymous-function-creation).
259
259
-[unset](10-expressions.md#unset).
260
260
261
-
###Reclamation and Automatic Memory Management
261
+
###Reclamation and Automatic Memory Management
262
262
The Engine is required to manage the lifetimes of VStores and HStores
263
263
using some form of automatic memory management.
264
264
In particular, when a VStore or HStore is created, memory is allocated for it.
@@ -297,8 +297,8 @@ a VSlot, this indicates that the VSlot has been reclaimed or, in the case
297
297
of a VSlot contained with an HStore, that the containing HStore has been
298
298
reclaimed or is eligible for reclamation.
299
299
300
-
###Assignment
301
-
####General
300
+
###Assignment
301
+
####General
302
302
This section and those immediately following it describe the abstract
303
303
model's implementation of *value assignment* and *byRef assignment*.
304
304
Value assignment of non-array types to local variables is described
@@ -311,7 +311,7 @@ Value assignment and byRef assignment are core to the PHP language, and
311
311
many other operations in this specification are described in terms of
312
312
value assignment and byRef assignment.
313
313
314
-
####Value Assignment of Scalar Types to a Local Variable
314
+
####Value Assignment of Scalar Types to a Local Variable
315
315
Value assignment is the primary means by which the programmer can create
316
316
local variables. If a local variable that appears on the left-hand side
317
317
of value assignment does not exist, the engine will bring a new local
@@ -439,7 +439,7 @@ defer copying a string's contents for value assignment so long as it has
439
439
no observable effect on behavior from any testable viewpoint (excluding
440
440
performance and resource consumption).
441
441
442
-
####Value Assignment of Objects to a Local Variable
442
+
####Value Assignment of Objects to a Local Variable
443
443
444
444
To demonstrate value assignment of objects to local variables, consider
445
445
the case in which we have a Point class that supports a two-dimensional
@@ -533,7 +533,7 @@ though they can have an arbitrarily large number of instance properties
533
533
of arbitrary type. Likewise, the same mechanics apply to value
534
534
assignment of all resource types.
535
535
536
-
####ByRef Assignment for Scalar Types with Local Variables
536
+
####ByRef Assignment for Scalar Types with Local Variables
537
537
Let's begin with the same value [assignment](10-expressions.md#simple-assignment) as in the previous
538
538
section, `$a = 123` and `$b = false`:
539
539
@@ -662,7 +662,7 @@ Note that literals, constants, and other expressions that don't
662
662
designate a modifiable lvalue cannot be used on the left- or right-hand
663
663
side of byRef assignment.
664
664
665
-
####ByRef Assignment of Non-Scalar Types with Local Variables
665
+
####ByRef Assignment of Non-Scalar Types with Local Variables
666
666
ByRef assignment of non-scalar types works using the same mechanism as
667
667
byRef assignment for scalar types. Nevertheless, it is worthwhile to
668
668
describe a few examples to clarify the semantics of byRef assignment.
@@ -736,7 +736,7 @@ Once all the aliases to the VStores are gone, the VStores can be
736
736
destroyed, in which case, there are no more pointers to the HStore, and
737
737
it can be destoyed too.
738
738
739
-
####Value Assignment of Array Types to Local Variables
739
+
####Value Assignment of Array Types to Local Variables
740
740
The semantics of value assignment of array types is different from value
741
741
assignment of other types. Recall the `Point` class from [the examples](#value-assignment-of-objects-to-a-local-variable), and consider the following [value assignments](10-expressions.md#simple-assignment) and their abstract implementation:
742
742
@@ -889,7 +889,7 @@ arrays even though they can have an arbitrarily large number
889
889
of elements. As to how an HStore accommodates all of them, is
890
890
unspecified and unimportant to the abstract model.
891
891
892
-
####Deferred Array Copying
892
+
####Deferred Array Copying
893
893
As mentioned in the [previous section](#value-assignment-of-array-types-to-local-variables), an implementation may
894
894
choose to use a deferred copy mechanism instead of eagerly making a copy
895
895
for value assignment of arrays. An implementation may use any deferred
@@ -1115,7 +1115,7 @@ difference, php.net's implementation produces behavior that is
1115
1115
compatible with the abstract model's definition of deferred array copy
1116
1116
mechanisms.
1117
1117
1118
-
####General Value Assignment
1118
+
####General Value Assignment
1119
1119
The sections above thus far have described the mechanics of value assignment
1120
1120
to a local variable. The assignment to a modifiable lvalue that is not a variable, such as array element or
1121
1121
object property, works like the local variable assignment, except that the VSlot which represented
@@ -1180,7 +1180,7 @@ is considered a modifiable lvalue, and the VSlot will be created by the engine a
1180
1180
to the appropriate HStore automatically. Static class properties are considered modifiable lvalues too,
1181
1181
though new ones would not be created automatically.
1182
1182
1183
-
####General ByRef Assignment
1183
+
####General ByRef Assignment
1184
1184
The sections above thus far have described the mechanics of byref assignment
1185
1185
with local variables. The byRef assignment to a modifiable lvalue that is not a variable,
1186
1186
such as array element or object property, works like the local variable assignment,
@@ -1205,15 +1205,15 @@ Will result in:
1205
1205
[VSlot $b *]---------------->[VStore int 123]<---------------------------------------+
1206
1206
```
1207
1207
1208
-
###Argument Passing
1208
+
###Argument Passing
1209
1209
Argument passing is defined in terms of [simple assignment](#assignment) or [byRef assignment](#byref-assignment-for-scalar-types-with-local-variables), depending on how the parameter is declared.
1210
1210
That is, passing an argument to a function having a corresponding
1211
1211
parameter is like assigning that argument to that parameter. The
1212
1212
function call situations involving missing arguments or
1213
1213
undefined variable arguments are discussed in section describing
1214
1214
[the function call operator](10-expressions.md#function-call-operator).
1215
1215
1216
-
###Value Returning
1216
+
###Value Returning
1217
1217
Returning a value from a function is defined in terms of [simple assignment](#assignment) or [byRef assignment](#byref-assignment-for-scalar-types-with-local-variables), depending on how the function is declared.
1218
1218
That is, returning a value from a function to its
1219
1219
caller is like assigning that value to the user of the caller's return
@@ -1248,7 +1248,7 @@ Passing function's return to another function is considered the same as assignin
1248
1248
the value to the corresponding function's parameter, with byRef parameters
1249
1249
treated as byRef assignments.
1250
1250
1251
-
###Cloning objects
1251
+
###Cloning objects
1252
1252
When an object instance is allocated, operator [`new`](10-expressions.md#the-new-operator) returns a handle
1253
1253
that points to that object. As described [above](#value-assignment-of-objects-to-a-local-variable),
1254
1254
value assignment of a handle to an object does not copy the object HStore itself. Instead, it creates a copy of the handle.
@@ -1294,7 +1294,7 @@ copy*. If a *deep copy* of an object is desired, the programmer must
1294
1294
achieve this manually by using the [method `__clone`](14-classes.md#method-__clone) which
1295
1295
is called after the initial shallow copy has been performed.
1296
1296
1297
-
##Scope
1297
+
##Scope
1298
1298
1299
1299
The same name can designate different things at different places in a
1300
1300
program. For each different thing that a name designates, that name is
@@ -1346,7 +1346,7 @@ When a [trait](16-traits.md#general) is used by a class or an interface, the [tr
1346
1346
members](16-traits.md#trait-declarations) take on the class scope of a member of that class or
1347
1347
interface.
1348
1348
1349
-
##Storage Duration
1349
+
##Storage Duration
1350
1350
1351
1351
The lifetime of a variable is the time during program execution that
1352
1352
storage for that variable is guaranteed to exist. This lifetime is
Copy file name to clipboardExpand all lines: spec/05-types.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
-
#Types
1
+
#Types
2
2
3
-
##General
3
+
##General
4
4
5
5
The meaning of a value is determined by its *type*. PHP's types are
6
6
categorized as *scalar types* and *composite types*. The scalar types
@@ -26,9 +26,9 @@ The same variable can contain values of different types at different times.
26
26
Useful library functions for interrogating and using type information
27
27
include [`gettype`](http://www.php.net/gettype), [`is_type`](http://www.php.net/is_type), [`settype`](http://www.php.net/settype), and [`var_dump`](http://www.php.net/var_dump).
28
28
29
-
##Scalar Types
29
+
##Scalar Types
30
30
31
-
###General
31
+
###General
32
32
33
33
The integer and floating-point types are collectively known as
34
34
*arithmetic types*. The library function [`is_numeric`](http://www.php.net/is_numeric) indicates if
@@ -43,7 +43,7 @@ convertible to scalar types (this is currently available only to internal classe
43
43
Such object types together with scalar types are called *scalar-compatible types*.
44
44
Note that the same object type may be scalar-compatible for one operation but not for another.
45
45
46
-
###The Boolean Type
46
+
###The Boolean Type
47
47
48
48
The Boolean type is `bool`, for which the name `boolean` is a synonym. This
49
49
type is capable of storing two distinct values, which correspond to the
@@ -53,7 +53,7 @@ The internal representation of this type and its values is unspecified.
53
53
The library function [`is_bool`](http://www.php.net/is_bool) indicates if a given value has type
54
54
`bool`.
55
55
56
-
###The Integer Type
56
+
###The Integer Type
57
57
58
58
There is one integer type, `int`, for which the name `integer` is a synonym.
59
59
This type is binary, signed, and uses twos-complement representation for
@@ -77,7 +77,7 @@ characteristics about type `int`.
77
77
The library function [`is_int`](http://www.php.net/is_int) indicates if a given value has type
78
78
`int`.
79
79
80
-
###The Floating-Point Type
80
+
###The Floating-Point Type
81
81
82
82
There is one floating-point type, `float`, for which the names `double` and
83
83
`real` are synonyms. The `float` type must support at least the range and
@@ -90,7 +90,7 @@ indicates if a given floating-point value is infinite. The library
90
90
function [`is_nan`](http://www.php.net/is_nan) indicates if a given floating-point value is a
91
91
`NaN`.
92
92
93
-
###The String Type
93
+
###The String Type
94
94
95
95
A string is a set of contiguous bytes that represents a sequence of zero
96
96
or more characters.
@@ -166,16 +166,16 @@ assignment, which involves the simple assignment [operator =](10-expressions.md#
166
166
The library function [`is_string`](http://www.php.net/is_string) indicates if a given value has
167
167
type string.
168
168
169
-
###The Null Type
169
+
###The Null Type
170
170
171
171
The null type has only one possible value, [`NULL`](06-constants.md#core-predefined-constants). The representation
172
172
of this type and its value is unspecified.
173
173
174
174
The library function [`is_null`](http://www.php.net/is_null) indicates if a given value is `NULL`.
175
175
176
-
##Composite Types
176
+
##Composite Types
177
177
178
-
###The Array Type
178
+
###The Array Type
179
179
180
180
An array is a data structure that contains a collection of zero or more
181
181
elements whose values are accessed through keys that are of type `int` or
@@ -184,7 +184,7 @@ elements whose values are accessed through keys that are of type `int` or
184
184
The library function [`is_array`](http://www.php.net/is_array) indicates if a given value is an
185
185
array.
186
186
187
-
###Objects
187
+
###Objects
188
188
189
189
An *object* is an instance of a [class](14-classes.md#classes). Each distinct
190
190
[*class-declaration*](14-classes.md#class-declarations) defines a new class type, and each class
@@ -194,7 +194,7 @@ The library function [`is_object`](http://www.php.net/is_object) indicates if a
194
194
object, and the library function
195
195
[`get_class`](http://php.net/manual/function.get-class.php) indicates the name of an object's class.
196
196
197
-
###Resources
197
+
###Resources
198
198
199
199
A [*resource*](http://php.net/manual/language.types.resource.php)
200
200
is a descriptor to some sort of external entity. Examples include
0 commit comments