PHP compact() function
The compact( ) function is an inbuilt function of PHP, and it is used to create an array from variables and their values. This function was introduced in PHP 4+.
This function returns an array with all the variables added to it.
Any strings that do not match variables names will be skipped.
Array ( [sachin] => 18426 [ganguly] => 11363 [virat] => 9779 )
Array ( [firstname] =>java [lastname] =>tpoint [location] =>noida )
Array ( [KR] => KERELA [FL] => FLOOD [HL] => 600cr )
Array ( [firstname] =>sachin [lastname] =>tendulkar [age] => 45 )