Skip navigation.

5 Ways to show that you're l33t

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 (([email protected]($h,1000,";"))!==!true) { I guess s/he doesn't know about false
  • if (([email protected]($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
    $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[email protected]fopen("test.txt",chr(114));
    b>while (($d[email protected]fgetcsv($h,1000,";"))!==!true) { // WTF #3</b>
        if ((
    $t=lI1("fahrzeuge.txt",$I,NULL,0))===NULL) {
    $t=array("$O $Q $o","$I[4]$I[5]-$I[6]$I[7]");

    b>if (($l1[email protected]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>
        [email protected]

    Comment viewing options

    Select your preferred way to display the comments and click "Save settings" to activate your changes.

    WTF 5: (int)0==4 will always be FALSE, not 0. Casting has a higher operator precedence than a comparison.

    I think the naming convetions deserve a WTF, too.
    (e.g: function lI1($ll,$lI,$Il,$b)).


    I especially like the first 2 lines.
    Why not defining three zillions constants having the same value?

    The word "KROENUNG" from the frist two lines probably should say that as a special bonus, the code produces not errors of type notice during execution. But this is no wonder since he uses the error suppression operator (@) several times. Sometimes just to add confusion, I guess.

    Some vocabulary:
    fahrzeuge = vehicles
    bundesland = federal state
    ort = city, location

    "nicht gefunden" = "not found"

    It looks more like a lousy job at obfuscating the code, not a wtf

    Why oh why?
    Why does he have to type a complete line just to define a constant to the value of *another constant*?
    It's like when somebody defines a ZERO constant with a value of... guess what, 0.
    And doesn't E_ALL (5 characters) take less typing than KROENUNG (8 characters)?

    The art of writing totally pointless code.

    Oh, and this one is great as well:

    [email protected]("test.txt",chr(114));

    Isn't it easier to just put 'r'? (WTF #4) But he also uses an octal number in one place and a decimal number in another.

    Oh yes, and check this one out:

    while(($I1=fgetcsv($l1,1000,";"))!==!(bool)1) {

    Come on, this guy can't be serious. Casting a int 1 to boolean and then negating it? Heck, he could just take out the !==!(bool)1 and it would do the same with less processing!

    Great WTF. Simply a masterpiece of WTFs.

    best WTF ever... or the best php obfuscator, ever.

    Here's a link to the original code:

    This has to be someone trying to obfusciate their code. This person obviously knows about some of the intracies of PHP, and has used them. Beginners don't generally use casts and variable variables.

    Function names like lI1() are designed to confuse, since their letters are visually similar. And using $as() & $am() instead of array_slice/merge() seems pretty deliberate.

    Underneath all the obfuscated code is the ugliest database engine. Note that its select function opens a file, parses each line searching for the passed key and returns the rest of the line or a default value back. (And has no way of returning multiple rows.) C'mon, classes were made for keeping file handles open, or chunks of data in memory. Here the best you can do is hope for a good disk cache. Imagine how the performance of this thing would drag when the reports became more than a few trivial lines.

    This is really very inperformant. For each data record out of test.txt he opens one or four files (depending on a search in the first one), walks through them until there is one matching record and closes them. This seems to be a kind of JOIN for csv files. I wonder if this was done intentionaly, because as someone already noted he doesn't seem to be a beginner.


    looking at the original site posted by phrax you can see that this code is just a joke. some newbie php programmer asked for help on a msg board and this code is what he gets.
    the best part is when he asks for "one more thing" (thats where KROENUNG comes in).

    Post new comment


    • Web and e-mail addresses are automatically converted into links.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <pre> <p> <br /> <br>