我创建了一个 PHP 脚本,但是在我的托管服务器中使用它时显示致命错误,然后我发现我需要压缩这个 PHP 代码才能使我的脚本工作。这是代码,任何人都可以用相同的输出,我是编码初学者,所以无法理解如何以最少的代码和努力来执行相同的输出,以便服务器可以轻松执行此代码。感谢代码需要优化:
$yar = 3;
while ($yar <= 9) {
$ax = 31;
while ($ax > 0) {
$jaan = "$ax Jan 200$yar";
$result = str_replace($jaan, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$feeb = "$ax Feb 200$yar";
$result = str_replace($feeb, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$maar = "$ax Mar 200$yar";
$result = str_replace($maar, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$appr = "$ax Apr 200$yar";
$result = str_replace($appr, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$maay = "$ax May 200$yar";
$result = str_replace($maay, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$juun = "$ax Jun 200$yar";
$result = str_replace($juun, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$juul = "$ax Jul 200$yar";
$result = str_replace($juul, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$auug = "$ax Aug 200$yar";
$result = str_replace($auug, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$seep = "$ax Sep 200$yar";
$result = str_replace($seep, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$occt = "$ax Oct 200$yar";
$result = str_replace($occt, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$noov = "$ax Nov 200$yar";
$result = str_replace($noov, " ", $result);
$ax = $ax - 1;
}
$ax = 31;
while ($ax > 0) {
$deec = "$ax Dec 200$yar";
$result = str_replace($deec, " ", $result);
}
$ax = $ax - 1;
$yar++;
} //years start after 2010 to 2014
$yr = 10;
while ($yr <= 14) {
$x = 31;
while ($x > 0) {
$jan = "$x Jan 20$yr";
$result = str_replace($jan, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$feb = "$x Feb 20$yr";
$result = str_replace($feb, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$mar = "$x Mar 20$yr";
$result = str_replace($mar, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$apr = "$x Apr 20$yr";
$result = str_replace($apr, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$may = "$x May 20$yr";
$result = str_replace($may, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$jun = "$x Jun 20$yr";
$result = str_replace($jun, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$jul = "$x Jul 20$yr";
$result = str_replace($jul, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$aug = "$x Aug 20$yr";
$result = str_replace($aug, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$sep = "$x Sep 20$yr";
$result = str_replace($sep, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$oct = "$x Oct 20$yr";
$result = str_replace($oct, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$nov = "$x Nov 20$yr";
$result = str_replace($nov, " ", $result);
$x = $x - 1;
}
$x = 31;
while ($x > 0) {
$dec = "$x Dec 20$yr";
$result = str_replace($dec, " ", $result);
$x = $x - 1;
}
$yr++;
}