title: PHP : how to use foreach loop inside an echo statement?
body: <p>i am tring to put a loop to echo a number inside an echo ;
  and i tried as bellow :</p>
  
  <pre><code>     $array = array();
       $result = mysql_query("SHOW TABLES FROM `st_db_1`");
       while($row = mysql_fetch_row($result) ){
       $result_tb = mysql_query("SELECT id FROM $row[0] LIMIT 1");
       $row_tb=mysql_fetch_array($result_tb);
       $array[] = $row[0];
       $array2[] = $row_tb[0];
       //checking for availbility of result_tb
       /*   if (!$result_tb) {
                    echo "DB Error, could not list tablesn";
                    echo 'MySQL Error: ' . mysql_error();
                    exit;
                    }  */
       }
       natsort($array);
       natsort($array2);
  
      foreach ($array as $item[0]  ) {
      echo "&lt;a href=show_cls_db.php?id= foreach ($array2 as $item2[0]){echo \"$item2[0]\"}&gt;{$item[0]}&lt;br/&gt;&lt;a/&gt;" ;
      }
  </code></pre>
  
  <p>but php is not considering foreach loop inside that echo ;
  please suggest me something  </p>