I found compact function very useful (in php). Here is what it does:
compact
$some_var = \'value\'; $ar = compact(\'some_var\'); //now $ar is array(\'so
You can also use phpjs library for using the same function in javascript same as in php
var1 = 'Kevin'; var2 = 'van'; var3 = 'Zonneveld'; compact('var1', 'var2', 'var3');
{'var1': 'Kevin', 'var2': 'van', 'var3': 'Zonneveld'}