5 Ways to show that you're l33t
Submitted by phrax on Fri, 2004-11-05 15:20.
Hall of Fame | Wonky Code
Somebody sent this in yesterday, it's in German, but bad code is bad in any language. There are so many WTFs with this code I had to summarize the best WTFs for you:
list($as,$nl)=explode("0","array_slice0<br>\n");
I guess actually declaring the variables $as and $nl took too many lines of code.$am=str_replace('slic','merg',$as);
*no comment* while (($d=@fgetcsv($h,1000,";"))!==!true) {
I guess s/he doesn't know about false
if (($l1=@fopen($ll,chr(0162))) === (bool) 0) return $Il;
to be l33t you gotta use 0162 rather than 'r'. Not sure what to say about casting 0 to a boolean false other than it is pointless.if ($I1[(int)0==4]===$lI||(int)4==0) {
This is the worst use of casting I've ever seen. Especially since (int)0==4
and (int)4==0
will always be 0. Maybe it's more l33tness.
<?php
define('KROENUNG',E_ALL);
error_reporting(KROENUNG);
$nO="[organisation nicht gefunden]";
$nb="[bundesland nicht gefunden]";
$no="[ort nicht gefunden]";
<b>list($as,$nl)=explode("0","array_slice0<br>\n"); // WTF #1</b>
<b>$am=str_replace('slic','merg',$as); // WTF #2</b>
$h=@fopen("test.txt",chr(114));
<b>while (($d=@fgetcsv($h,1000,";"))!==!true) { // WTF #3</b>
$I=$d[0];
if (($t=lI1("fahrzeuge.txt",$I,NULL,0))===NULL) {
$Q=lI1("bundesland.txt",$I[1],$nb,1);
$o=lI1("ort.txt",$I[2].$I[3],$no,1);
$O=lI1("organisation.txt",$I[0],$nO,1);
$t=array("$O $Q $o","$I[4]$I[5]-$I[6]$I[7]");
}
$z=$am($as($d,0,1),$t,$as($d,1));
echo implode(";",$z),$nl;
}
fclose($h);
function lI1($ll,$lI,$Il,$b)
{
global $as;
<b>if (($l1=@fopen($ll,chr(0162))) === (bool) 0) return $Il; // WTF #4</b>
while(($I1=fgetcsv($l1,1000,";"))!==!(bool)1) {
<b>if ($I1[(int)0==4]===$lI||(int)4==0) { // WTF #5</b>
$II=$as($I1,1);
break;
}
}
fclose($l1);
return@$II?($b?$II[0]:$II):$Il;
}
?>