Gen. partnerAlgotech

PHP function compact()

Create array containing variables and their values

|
September 11, 2019

Availability in PHP 4.0

Create array containing variables and their values

Parameters

Parameter Data type Default value Note
$varname mixed not 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.
$_ mixed null

Return values

array

the output array with all the variables added to it.

Additional resources

Official documentation of the compact function

Loading comments...

Stay in the loop

Subscribe to our newsletter and get the latest cybersecurity news delivered straight to your inbox.

Your data is safe. You can unsubscribe from the newsletter at any time.