I'm trying to create a string out of several array values like so:
$input = array("1140", "1141", "1142", "1144", "1143", "1102");
$rand_keys = array_rand($input, 2);
$str = "$input[$rand_keys[0]], $input[$rand_keys[1]]";
However, in the third line, I get this error: Unexpected '[' expecting ']'
I thought that by converting the array to a value I would be able to use it in my string. What am I doing wrong with my syntax?

implode()?$str = $input[$rand_keys[0]] .', '. $input[$rand_keys[1]];... but for that, I'd definitely do what @JayBlanchard asked, and use implode.$str = "{$input[$rand_keys[0]]}, {$input[$rand_keys[1]]}";should work. But +4 on an implode implementation. Much more readable.