fork download
  1. <?php
  2. $n = 3;//fopen('php://stdin', "r");
  3. $ho = fopen('php://stdout', "w");
  4.  
  5. if($n<=2 && $n%2==0){
  6. return;
  7. }
  8.  
  9. //first part
  10. for($i=0;$i<$n+2;$i++)
  11. {
  12. for($j=1;$j<($n+2)+1;$j++){
  13. if( ceil(($n+2)/2) ==$j ){
  14. echo "e";
  15. }else{
  16. echo " "; //replace &nbsp; if its diff compiler
  17. }
  18. }
  19. echo "\n"; // replace <br> if its diff compiler
  20. }
  21.  
  22. //second part
  23. for($i=1;$i<=$n;$i++)
  24. {
  25. for($j=0;$j<($n+2);$j++){
  26. echo "*";
  27. }
  28.  
  29. if( ceil($n/2) ==$i ){
  30. for($j=0;$j<($n+2);$j++){
  31. echo "e";
  32. }
  33. }
  34. echo "\n";
  35. }
  36.  
  37.  
  38. fclose($ho);
  39. fclose($n);
Success #stdin #stdout #stderr 0.04s 25624KB
stdin
Standard input is empty
stdout
  e  
  e  
  e  
  e  
  e  
*****
*****eeeee
*****
stderr
PHP Warning:  fclose() expects parameter 1 to be resource, int given in /home/57V8F6/prog.php on line 39