title: Store html content generated with PHP into a variable
body: <p>I have some PHP code mixed with HTML and i need to store this  into a variable but i can't figure out how can i do that. When this code is executed, is called from a shortcode that calls the function and works perfectly.The PHP code render the HTML and shows the information from the DB, but now i need to store the result <code>(this html divs boxes with information from the database)</code> into a variable in order to send this variable to a function in wordpress that can update a page. When i try it, there is a error that say echo isnt spected. I know that this variable doesn't spect php code inside, so how can i do that? store the result into a variable?</p>
  
  <p>any suggestion will be very apreciated
  thank you in advance:</p>
  
  <pre><code>$ultimosProyectosHome+="
  echo '&lt;div class="cont-proyectos"&gt;';
  echo '&lt;div style="text-align:center;"&gt;&lt;a href="'. $url_actual .'"?      page_id="'. $id_paginaFicha .'" target="_blank"&gt;';if($pregunta6Valor!=""){echo '&lt;img src="http://www.xxx.xx/xxx/xxx/'.$pregunta6Valor.'" alt="Cover"&gt;&lt;/a&gt;&lt;/div&gt;';} else{echo '&lt;img src="'.$imgDesafio.'" alt="Cover"&gt;&lt;/a&gt;&lt;/div&gt;';}
                              echo '&lt;h3&gt;';if($pregunta2Valor != ""){ echo $pregunta2Valor;}else{echo $Nodefinido;}echo'&lt;/h3&gt;';
  
                               echo'&lt;a href="'. $url_actual .'"?page_id="'. $id_paginaFicha .'" target="_blank"&gt;';
                                      echo'&lt;h4&gt;';if($pregunta1Valor != ""){ echo $pregunta1Valor;}else{echo $Nodefinido;} echo'&lt;/h4&gt;';
                                  echo'&lt;/a&gt;';                                    
                                  echo'&lt;p&gt;'; if($pregunta3Valor != ""){ echo getSubString($pregunta3Valor,198,$id_paginaFicha);}else{echo $Nodefinido;} echo'&lt;/p&gt;'; 
  
                                  echo'&lt;div class="redesSocialesTLP" id="redes"&gt;';
                                      echo'&lt;a href="https://twitter.com/intent/tweet?url="'. $url_client .'"?page_id="'. $id_paginaFicha .'"&amp;text="'. $pregunta1Valor .'" target="_blank"&gt;';
  
                                          echo'&lt;i class="fa fa-twitter fa-2x"&gt;&lt;/i&gt;';
                                      echo'&lt;/a&gt;';
  
  
                                      echo'&lt;a href="https://www.facebook.com/sharer/sharer.php?u="'. $url_client .'"?page_id="'. $id_paginaFicha .'" target="_blank"&gt;';
  
                                          echo'&lt;i class="fa fa-facebook fa-2x"&gt;&lt;/i&gt;';
                                      echo'&lt;/a&gt;';
  
                                      echo'&lt;a href="https://plus.google.com/share?url="'. $url_client .'"?page_id="'. $id_paginaFicha .'" target="_blank"&gt;';
  
                                          echo'&lt;i class="fa fa-google-plus fa-2x"&gt;&lt;/i&gt;';
                                      echo'&lt;/a&gt;';
                                  echo'&lt;/div&gt;';
                              echo'&lt;/div&gt;';
  </code></pre>
  
  <p>"; </p>