compact

it create array containing variables and their values

Example

<?php
echo “<pre>”;
$web  = “PHP”;
$clinet = “Brwoser”;
$vars = array(“clinet”);
$array = compact(“web”, “nothing_here”, $vars);
print_r($array);
?>

Output

Array
(
[web] => PHP
[clinet] => Brwoser
)

Share