Ho provato il programma ma non capisco come fare a recupeare il valore di una variabile.

Utilizzando zend mi capita di avere delle action nelle quali non posso fare echo valore_var; die; .... ad esempio nel caso in cui credo una stringa json.

nell'esempio che posto ora, non riesco a visualizzare il valore dell'sql facendo l'echo (non visualzza nessun valore a video), come posso tramite un sistemat di debug tipo quello suggerito

Codice PHP:
 if ($this->getRequest()->isPost())
        {
            
$data $this->getRequest()->getPost();

            
$page $data['page'];
            
$rp $data['rp'];
            
$sortname $data['sortname'];
            
$sortorder $data['sortorder'];

            ...

            
$sort " ORDER BY $sortname $sortorder ";

            if (!
$page$page 1;
            if (!
$rp$rp 10;

            
$start = (($page-1) * $rp);
            
$limit "LIMIT $start$rp";

            
//get query condition if there is set on
            
$query $data['query'];
            
$qtype $data['qtype'];
......

            
//get main adapter config
            
$configuration = new Zend_Config_Ini(APPLICATION_PATH '/configs/application.ini','production');

            
$dbAdapter Zend_Db::factory($configuration->resources->db->adapter,
                                          
$configuration->resources->db->params->toArray());
            
            
//echo $where;exit;

            //Conteggio records utenti col filtro impostato
            
$stmt $dbAdapter->query('SELECT COUNT(*) As count FROM users'$where);
            
$countusers $stmt->fetch();
            
$total $countusers['count'];

            
//Query finale con where, sort e order
            
$sql "SELECT * FROM users INNER JOIN state ON state.stateId= users.stateId
                                        INNER JOIN city ON city.cityId= users.cityId
                                        INNER JOIN town ON town.townId= users.townId
                                        
$where $sort $limit";
                                        
            
//echo $sql;exit;

            
$stmt $dbAdapter->query($sql);
            
$users $stmt->fetchAll();

            
$json "";
            
$json .= "{\n";
            
$json .= "page: $page,\n";
            
$json .= "total: $total,\n";
            
$json .= "rows: [";
            
$rc false;

            foreach (
$users as $user)
            {

                if (
$rc$json .= ",";
                
$json .= "\n{";
                
$json .= "id:'".$user['userId']."',";
                
$json .= "cell:['".addslashes($user['userId'])."'";

                
$json .= ",'".$user['regDate']."']";
                
$json .= "}";
                
$rc true;
            }

            
$json .= "]\n";
            
$json .= "}";
            echo 
$json;
            exit;

        }