UK[kəmˈpækt] US[ˈkɑ:mˈpækt]
vt.& vi. Press, (make) solid; make... tight, make... strong; make (style) concise, simplify; become compact, become strong
adj. compact; concise, (style, etc.) compact; small and easy to carry; (material) dense, (physical) strong
n. Agreement; treaty; small compact with mirror; car
Third person singular: compacts Present participle: compacting Past tense: compacted Past participle: compacted
php compact() function syntax
Function:Create an array containing variable names and their values
Syntax:compact(var1,var2...)
Parameters:
Parameters | Description |
Required. Can be a string with a variable name, or an array of variables. | |
Optional. Can be a string with a variable name, or an array of variables. Multiple parameters are allowed. |
Description:Create an array containing variable names and their values. Any string that does not have a corresponding variable name is ignored.
php compact() function example
Output:
Array ( [firstname] => 西门 [lastname] => 灭绝 [age] => 25 )
Output:
Array ( [name] => 无忌 [job] => 讲师 [age] => 20 )