PHP, Creating a dynamic variable

Your own solution works I guess (double $$) but usually you do it this way:

$quantity['type'] = 1;
${'message' . $quantity['type']} = 'hello';
echo $message1; // hello