PHP with Applescript: problems with vars

Hello
I don’t know what I am doing wrong:

This does work:


set _php_cmd to "echo 'Result No.# ' . 1 ;"
set _result to do shell script "php -r \"" & _php_cmd & "\""
-- This returns "Result No.# 1", fine

This gives an error:


set _php_cmd to "$v=\"Hello\";"
set _result to do shell script "php -r \"" & _php_cmd & "\""
-- This returns "error: PHP Parse error:  parse error in Command line code on line 1"

Altough I describe myself as an experienced programmer I do not find the solution since a long time working on it. It seems, that the $Var-Declaration is the problem? On my localhost-webserver my preg_match-PHP-Script is working as expected.
Is it necessary to do something in the PHP.ini-File?
Kind regards and best thanks for your attention
Hans

Model: mavericks
AppleScript: 2.4
Browser: Safari 602.2.14
Operating System: Mac OS X (10.10)

I think a found the problem:

set _php_cmd to “$v="Hello";”
set _result to do shell script “php -r ‘’” & _php_cmd & “'”
– Use single quotes for the php statement: do shell script "php -r ‘[PHP-Code with $vars]’ "

Have a nice time
Hans