fork download
  1. <?php
  2. // original
  3. #$a=[zzyy,' zyy ',syys,' yyz ',yyzz,xysxz,zssz,xzsyx];while($i<32){$b=$a[$i++%8];$b=str_replace([z,x,y,s],['\\\\','\\','//',' '],$b);echo"$b$b$b$b$b$b\n";}
  4.  
  5. // 1) Use $a[...] directly as parameter instead of assigning it to $b. (-6)
  6. #$a=[zzyy,' zyy ',syys,' yyz ',yyzz,xysxz,zssz,xzsyx];while($i<32){$b=str_replace([z,x,y,s],['\\\\','\\','//',' '],$a[$i++%8]);echo"$b$b$b$b$b$b\n";}
  7.  
  8. // 2) Use strtr instead of str_replace. (-4)
  9. #$a=[zzyy,' zyy ',syys,' yyz ',yyzz,xysxz,zssz,xzsyx];while($i<32){$b=strtr($a[$i++%8],[z=>'\\\\',x=>'\\',y=>'//',s=>' ']);echo"$b$b$b$b$b$b\n";}
  10.  
  11. // 3) Use digits instead of letters. (-10)
  12. #$a=[3322,' 322 ','0220',' 223 ',2233,12013,3003,13021];while($i<32){$b=strtr($a[$i++%8],[' ','\\','//','\\\\']);echo"$b$b$b$b$b$b\n";}
  13.  
  14. // 4) Assign $b in the echo. (-4)
  15. #$a=[3322,' 322 ','0220',' 223 ',2233,12013,3003,13021];while($i<32)echo$b=strtr($a[$i++%8],[' ','\\','//','\\\\']),"$b$b$b$b$b\n";
  16.  
  17. // 5) Don´t assign $a, just use it. (-6)
  18. while($i<32)echo$b=strtr([3322,' 322 ','0220',' 223 ',2233,12013,3003,13021][$i++%8],[' ','\\','//','\\\\']),"$b$b$b$b$b\n";
  19.  
Success #stdin #stdout #stderr 0.01s 52488KB
stdin
Standard input is empty
stdout
\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////
 \\////  \\////  \\////  \\////  \\////  \\//// 
  ////    ////    ////    ////    ////    ////  
 ////\\  ////\\  ////\\  ////\\  ////\\  ////\\ 
////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\
\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\
\\    \\\\    \\\\    \\\\    \\\\    \\\\    \\
\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\
\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////
 \\////  \\////  \\////  \\////  \\////  \\//// 
  ////    ////    ////    ////    ////    ////  
 ////\\  ////\\  ////\\  ////\\  ////\\  ////\\ 
////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\
\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\
\\    \\\\    \\\\    \\\\    \\\\    \\\\    \\
\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\
\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////
 \\////  \\////  \\////  \\////  \\////  \\//// 
  ////    ////    ////    ////    ////    ////  
 ////\\  ////\\  ////\\  ////\\  ////\\  ////\\ 
////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\
\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\
\\    \\\\    \\\\    \\\\    \\\\    \\\\    \\
\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\
\\\\////\\\\////\\\\////\\\\////\\\\////\\\\////
 \\////  \\////  \\////  \\////  \\////  \\//// 
  ////    ////    ////    ////    ////    ////  
 ////\\  ////\\  ////\\  ////\\  ////\\  ////\\ 
////\\\\////\\\\////\\\\////\\\\////\\\\////\\\\
\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\\//  \\\
\\    \\\\    \\\\    \\\\    \\\\    \\\\    \\
\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\\\\  //\
stderr
PHP Notice:  Undefined variable: i in /home/fXj4Sz/prog.php on line 18
PHP Notice:  Undefined variable: i in /home/fXj4Sz/prog.php on line 18