通过osascript - e传递AppleScript中的php变量

I am trying to run an applescript and pass some php variables to it. For some reason I cannot run the script as a file, therefore I try to do run the script using osascript e-. I am familiar with the way to run the file as script and pass some arguments to it, but is it possible to do it like I show below?

Here is my code

$text="hello";
exec('osascript\ display dialog \"$text"\ \'');

Is there a way to do such thing?