AGI-PHP, problem getting the variable

I tried with this, but the variable is empty, but in the asterisk CLI, is getting the variable correctly, but in the PHP script the variable is empty, Why?

This is my script

$agi->text2wav('Digita tu numero y despues presiona la tecla gato'); $agi->exec('Read', 'mivar|beep|14||2|50'); $mivar = $agi->get_variable(mivar); $agi->verbose($mivar); if ($myvar['result'] == 1 && $myvar['data'] != '') { $agi->text2wav('Es'.$myvar['data']); } else { $agi->text2wav('No introdujo la variable jajaja'); }

And this is showing the asterisk CLI

AGI Script Executing Application: (Read) Options: (mivar|beep|14||2|50)
– User entered ‘23548412’
/var/lib/asterisk/agi-bin/a.php,: Array
/var/lib/asterisk/agi-bin/a.php,: (
/var/lib/asterisk/agi-bin/a.php,: [code] => 200
/var/lib/asterisk/agi-bin/a.php,: [result] => 0
/var/lib/asterisk/agi-bin/a.php,: [data] =>
/var/lib/asterisk/agi-bin/a.php,: )
/var/lib/asterisk/agi-bin/a.php,:

i am having the same problem. Somebody please help!

i guess this line: $agi->text2wav(‘Es’.$myvar[‘data’]); should be
$agi->text2wav(‘Es’.$mivar[‘data’]);
and if it’s just a miss typing then try:
$mivar = $agi->get_variable(“mivar”);