How can I get the value $fbAppPath
into the PHP statement below?
<? print json_encode(array(array('text' => 'Become A Fan', 'href' => '$fbAppPath'))); ?>
You cannot get a variable in a single quote string. PHP interprets all single-quoted strings EXACTLY as they appear. (aside from escaping a single quote)
The ONLY way to get a variable while using single quotes is to break out of them:
$foo = 'variable';
echo 'single-quoted-string-'.$foo.'-more-single-quoted-string';