How to set variables from array data in dialplan


I am having asterisk- on my CentOS system.

I want to call the phpagi script to fetch the data from the database.
When there is one row, my php script is fetching the data properly. I can set the agi variables and the dialplan works proper.
But when there are more than one rows, the PHP script is properly fetching the data. But I m getting issues, when I try to set the agi variables using agi->set_variable().

Below is my tracking.php


// create a connection to the local host mono .NET pull back the wsdl to get the functions names
// and also the parameters and return values

$client = new SoapClient(“”,
“trace” => 1, // enable trace to view what is happening
"exceptions" => 0, // disable exceptions
"cache_wsdl" => 0) // disable any caching on the wsdl, encase you alter the wsdl server

// fetch the work no parameters.

$webService=$client->GetData(array(“tech_code” => $tech_code,“work_no” => $work_no,“return_type” => $return_type,“phone_number” => $phone_num ));

$test=json_decode($json, true);

echo “

echo “

echo “\n”;
echo $item_description=$test[$i][‘item_description’];
echo “

//$agi->SET_VARIABLE('tech_code', $test[$i]['tech_code']);
//$agi->SET_VARIABLE('work_no', $test[$i]['work_no']);

$temp = $test[$i]['item_no'];
echo "=================" . $temp;
$agi->set_variable('item_no', $temp);


And the extensions.conf :

Error :