title: A funny exercise using by for loop
body: <p>I am interested in the loop exercise and saw a funny questions as below shown.</p>
  
  <ul>
  <li>Create a script to construct the following pattern, using a nested for loop. </li>
  <li>For the implementation, please using "echo" and showed by the table form.</li>
  </ul>
  
  <pre>0 0 1 0 0
  0 1 1 1 0
  1 1 1 1 1
  0 1 1 1 0
  0 0 1 0 0</pre>
  
  <p>I try hard and coding an hour but I could not be succes and I can implement an triangle as</p>
  
  <pre>1 0 0 0 0
  1 1 0 0 0
  1 1 1 0 0
  1 1 1 1 0
  1 1 1 1 1</pre>
  
  <p>I understand my knowledge of martix and array is poor, I am pleased if anyone can teach me, thank you.</p>
  
  <p>code of triangle loop:</p>
  
  <pre><code>    &lt;?php 
          for($i=1;$i&lt;=5;$i++){  
              for ($j=1;$j&lt;=$i;$j++){  
                  echo "1";  
              } 
              echo "&lt;/br&gt;";  
          }
      ?&gt;
  </code></pre>
  
  <p>Hello everyone, I had been completed the execrise by stupid way, thanks for everyone who helps me.</p>
  
  <p>Here is my silly code:
          
  
  <pre><code>for($i=1;$i&lt;=$num;$i++){
    for($j=1;$j&lt;=$num;$j++){  
      if($i==3||$j==3){  
        echo ' 1 ';
      }
      else if($i==$j-2){
        echo ' 1 ';
      }
      else if($j==$i-2){
        echo ' 1 ';
      }
      else if($i==2&amp;&amp;$j==2||$i==4&amp;&amp;$j==4){
        echo ' 1 ';
      }
      else{
        echo ' 0 ';
      }                 
    }   
      echo'&lt;br&gt;';   
  }
  </code></pre>