What i must to to dor my dial plan get a Var from a php agi file

i did a php that must return 3 vars to my dial plan.
in dial plan i used this lines to use my agi

 exten => 1235,n(APIAI),agi(jasar.api.ai.agi,${msgvar},  ${sId})
 exten => 1235,n,Verbose(1,Script returned: ${msg} , ${sId}, ${andamento})

but in comand line in verbose mode

i are sayng that Script Returned: , ,

in my php file i tryed to return vars from many forms

$return = array($resposta,$result['sessionId'],$andamento);
or
$return = "$resposta,$result[sessionId],$andamento";

and

return $return;
or
echo $return;

but nome of then worked.
some one could teach me how my php file can pass theses three vars to my dial pan?

I will give you 2 ways to achieve this task

Method 1 echo the variable content and grab the value using Asterisk Shell() function.

Mehtod 2 Use PHPAGI class
set_variable()

Sets a variable to the specified value. The variables so created can later be used by later using ${variablename} in the dialplan.

tank you i will try to use this agi that you told ^^

This is the link for the PHPAGI class if you decided to use the second method http://phpagi.sourceforge.net/phpagi22/api-docs/