fork(3) download
  1. <?php
  2.  
  3. $input = 21;
  4. if ($input % 2 === 0) die("Input must be an odd number");
  5.  
  6. for ($i = 0; $i < $input; $i++) {
  7. for ($j = 0; $j < $input; $j++) {
  8. echo (($j == $i) || ($j == $input-$i-1)) ? '*' : ' ';
  9. }
  10. echo "\n";
  11. }
Success #stdin #stdout 0.02s 52432KB
stdin
Standard input is empty
stdout
*                   *
 *                 * 
  *               *  
   *             *   
    *           *    
     *         *     
      *       *      
       *     *       
        *   *        
         * *         
          *          
         * *         
        *   *        
       *     *       
      *       *      
     *         *     
    *           *    
   *             *   
  *               *  
 *                 * 
*                   *