Problem with php agi get_data()

I am using get_data() function to input data from the user.
But there is one problem with the function. if i entered for eg: only 3 digits it will reply back some 5 digit. what is going wrong.
#!/usr/bin/php -q

<?php ob_implicit_flush(false); //Declarations unset($agi); $agi = new AGI(); $r1 = 5; do { $r1 = $r1 - 1; $ssn = getdata(); }while($r1 != "0"); function getdata() { GLOBAL $agi; $agi->text2wav("After hearing the beep sound please enter your regi ion number"); unset($ttresult); unset($ttssn); unset ($ttresult['result']); $ttresult = $agi->get_data("beep",30000,9); $ttssn = $ttresult['result']; $agi->say_digits($ttssn); $agi->conlog(" the value of ttssn = ".$ttssn); $agi->conlog("the value from array = ".$ttresult['result']); return $ttssn; } ?>

whatt is going wrong with my code