I have the following array:
$var_array = array(
"length" => 5,
"breadth" => 5,
"color" => "blue",
"size" => "medium",
"shape" => "square");
How do I extract selected variables out of the array by specifying the keys?
Example if I specify breadth and size, I get:
$breadth = 5;
$size = "medium";
$var_array = array(
"length" => 5,
"color" => "blue",
"shape" => "square");
array_diff_keyandarray_intersect_key:Will produce:
If you want to put them into local variables you can do:
Or a less clear version: