I'm learning PHP and I encounter this piece of code:
$args = [
"msg" => "hello world!"
];
foreach ($args as $key => $value) {
$$key = $value;
}
echo $msg; // prints hello world!
Why can I acces $msg if it was created inside the for loop? Shouldn't it be out of context?