この質問の仕方がわかりませんが、次のようになります。
$id = 1;
$age = 2;
$sort = "id"; // or "age";
$arr = array($$sort => 'string'); // so that it becomes 1 => 'string'
^ what goes here? // instead of 'id' => string'
これは&
文字が「変数変数」に使用されるものですか?
または多分eval
?