在file_get_contents中定义变量

I have this code

<?php
$a1 = 'http://www.hamooz.com';
$a2 = 'http://www.myegy.com';
$a3 = 'http://www.tech-wd.com/wd';
$num = rand(1,3);

$numb =  '$a'.$num;

echo file_get_contents($numb);
?>

the problem appear like:

Warning: file_get_contents($a3) [function.file-get-contents]: failed to open stream: No such file or directory in C:\xampp\htdocs\ttt\bessah.php on line 9

Variable variables are a bad practice. Use an array instead.

<?php

$a = array();
$a[] = 'http://www.hamooz.com';
$a[] = 'http://www.myegy.com';
$a[] = 'http://www.tech-wd.com/wd';
$num = rand(0,2);

$numb = $a[$num];

echo file_get_contents($numb);
?>

For this specific task however, there is also a shortcut:

array_rand ( )

Picks one or more random entries out of an array, and returns the key (or keys) of the random entries.

You need to do $numb = ${'a'.$num};, but use the array solution as @Pekka's answer.

I agree with @Pekka you're going to complicate your code, but if you absolutly want to use dynamic variables you can do :

<?php
$a1="hello";
$b=1;
echo ${"a$b"};
?>