PHP Code:
$ set -x # open xtrace option to help for debugging
$ aa=AAAA # set $aa to AAAA
+ aa=AAAA
$ _var=aa # set $_var to aa
+ _var=aa
$ echo ${aa}
+ echo AAAA
AAAA
$ echo ${_var}
+ echo aa
aa
$ echo ${b}
+ echo
$ b=$( eval echo \$$_var ) # this method as expected
+ eval echo '$aa'
+ echo AAAA
+ b=AAAA
$ echo ${b}
+ echo AAAA
AAAA
$ b=`eval echo \$$_var` # this method not as expected ,should it be same result as previous method?
+ eval echo 1401_var
+ echo 1401_var
+ b=1401_var
$ echo ${b}
+ echo 1401_var
1401_var
ref to "http://www.freebsd.org/cgi/man.cgi?query=sh&manpath=FreeBSD+8.1-RELEASE" command substitution section
environment ===
FreeBSD abc.xyz.com 8.1-RELEASE FreeBSD 8.1-RELEASE #0: Mon Jul 19 02:55:53 UTC 2010
root@almeida.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC i386