Menu Samaritan's Purse

COMPACT

Create array containing variables and their values

SYNTAX

compact ( mixed $varname1 [, mixed $... ] ) : array

PARAMETERS

varname1

compact() takes a variable number of parameters. Each parameter can be either a string containing the name of the variable, or an array of variable names. The array can contain other arrays of variable names inside it; compact() handles it recursively.

RETURN

Returns the output array with all the variables added to it.

EXAMPLES

Array
(
    [memorial] => Mount Rushmore National Memorial
    [city] => Keystone
    [state] => South Dakota
)

PHP