• Masm (unregistered)

    $f.$i.$r.$s.$t.'?'

  • Ben Jammin (unregistered)

    Every guru knows about job security

  • DiverKas (unregistered)

    Guru and php is pretty much an oxymoron isnt it?

  • (cs)

    And this is why anyone who calls themselves a "guru" should be fired immediately. Nevermind that all of these stories that feature a so-called guru in Language X always ends up with the person writing shitty code.

  • Buddy (unregistered) in reply to DiverKas
    DiverKas:
    Guru and php is pretty much an oxymoron isnt it?
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.
  • NoXzema (unregistered)

    I hope I don't get like that someday... :/

  • (cs) in reply to Buddy
    Buddy:
    DiverKas:
    Guru and php is pretty much an oxymoron isnt it?
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.

    and then you could be even less of a dumb ass by realizing that you're trying to say the language is bad by demonstrating a misuse of the language

    and then you could continue by realizing that most dynamically typed languages would behave the same

    then you could look up the === operator (yes three ='s) in PHP

    oh but i forgot.... it's the in thing here to bash PHP since it's the competitor to C# ASP/.NET.

    PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.

  • (cs) in reply to Kazan
    Kazan:
    Buddy:
    When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.
    and then you could continue by realizing that most dynamically typed languages would behave the same
    I think he did realise that, but I'll leave it to someone else to really kick off the static vs dynamic typing flame war.
  • Buddy (unregistered) in reply to Kazan
    Kazan:
    Buddy:
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero. ...

    '0' is a non-empty string, (bool)'0' evaluates to FALSE.

  • (cs) in reply to Buddy
    Buddy:
    Kazan:
    Buddy:
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero. ...

    '0' is a non-empty string, (bool)'0' evaluates to FALSE.

    it also is the numeric value zero... a string which is comprised of only decimal digits is considered a number for all intents and purposes. it's a weakly typed language, get over it.

  • morry (unregistered)

    Way to confirm the irreplaceability of the guru.

  • Buddy (unregistered) in reply to Buddy
    Buddy:
    Kazan:
    Buddy:
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero. ...

    '0' is a non-empty string, (bool)'0' evaluates to FALSE.

    Before, I get stomped on, I understand it's technically empty according to PHP is_empty, but everywhere else, '0' is not an empty string!

  • OldHand (unregistered)

    I have the feeling I once had this deja vu experience of seeing some similar code...

  • Mike (unregistered) in reply to Buddy
    Buddy:
    Kazan:
    Buddy:
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero. ...

    '0' is a non-empty string, (bool)'0' evaluates to FALSE.

    Yes, '0' is non-empty; however, it is not non-zero.

  • (cs) in reply to Mike
    Mike:
    Buddy:
    Kazan:
    Buddy:
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE ...

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero. ...

    '0' is a non-empty string, (bool)'0' evaluates to FALSE.

    Yes, '0' is non-empty; however, it is not non-zero.

    he was pouncing on my generalize of non-empty strings being considered non-zero... because i simply didn't add "unless its contents are the number zero"

  • (cs) in reply to Kazan
    Kazan:
    Buddy:
    DiverKas:
    Guru and php is pretty much an oxymoron isnt it?
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.
    PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.

    As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.

  • Patrick (unregistered)

    I once knew a programmer who would swear by his practice of prefixing all function names with A, B, C, depending on the order in which they executed in their main thread. If they called functions of their own, those would be named AA, AB, AC, BA, BB, BC, etc...

    And if both A_Something and B_Other called a common function, you would end up with AA_BA_Helper. Or AA_Helper and BA_Helper both calling _SHARED_Helper.

    Sometimes profanity would be spelled out in the prefixes (totally inadvertently, of course), and the function names also had a habit of not being particularly descriptive. Like Go, Do, Run, Filter, etc...

    Of course, other programmers knew the stupidity of this system and ignored the prefixes, creating functions with identical names (just without the prefixes) or not adding extra prefixes to functions called by many. It was a nightmare of backtracking. By the time I got to it, I spent most of my time deleting duplicates and renaming everything. I actually doubled the speed of the application without changing a single line of 'meat' code.

  • JayC (unregistered) in reply to Buddy

    Yup, that about covers all cases. Javascript's the same way. Annoying, yes, but it's not that hard to figure out... granted, anybody who is using a string value in a boolean context and NOT trying to implement some obfuscatedfullery ought to be... I don't know, <INSERT BAD HAPPENSTANCE HERE>.

  • ClaudeSuck.de (unregistered) in reply to Kazan
    Kazan:
    Buddy:
    DiverKas:
    Guru and php is pretty much an oxymoron isnt it?
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.

    or you could simply not be a jackass and realize that any-non-zero value is considered true and a non-empty string is considered non-zero.

    and then you could be even less of a dumb ass by realizing that you're trying to say the language is bad by demonstrating a misuse of the language

    and then you could continue by realizing that most dynamically typed languages would behave the same

    then you could look up the === operator (yes three ='s) in PHP

    oh but i forgot.... it's the in thing here to bash PHP since it's the competitor to C# ASP/.NET.

    PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.

    The Real WTF is PHP for their stupid boolean evaluation, Ha! QED

  • Procedural (unregistered) in reply to jonnyq
    jonnyq:
    Kazan:
    Buddy:
    DiverKas:
    Guru and php is pretty much an oxymoron isnt it?
    Pretty much. When a language evaluates (bool)'0', (bool)'' to FALSE but (bool)'false', (bool)'no', (bool)'0.0' to TRUE, you know you're in for a world of hurt.
    PS: PHP isn't a bad language, it's however an EASY language - easy languages get a higher proportion of bad programmers.

    As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.

    I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English.

  • Osno (unregistered)

    Better:

    function happenstance($a, $b, $c) { "Select" .$a. " FROM " .$b. " " .$c; }

    happenstance('f_name', 't_happenstances', 'LIMIT 0,1');

  • (cs) in reply to jonnyq
    jonnyq:
    As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.

    my main qualification is C++, i have written a lot of php code and was paid to write LAMP eCommerce apps for 18 months.. only thing i couldn't find a good solution for is the Call Super, which C++ also lacks a good solution to (hence I avoid anything useful that could come from a solution to call super)

  • (cs)

    This comment is brilliant, you know!

  • Herby (unregistered)

    This is a primary example of "Job Security", or "Ease of understandability (well documented)". Looks like you only get to pick one.

    A true "guru" will have both, and will not be self described.

  • Neil (unregistered) in reply to Charles400
    Charles400:
    This comment is brilliant, you know!
    You truly are a comment guru.
  • A Gould (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    And this is why anyone who calls themselves a "guru" should be fired immediately. Nevermind that all of these stories that feature a so-called guru in Language X always ends up with the person writing shitty code.

    Quoted for truth.

    Titles like "elite" and "guru" are given, not taken. If other people aren't calling you The Man, you aren't (or at least, aren't yet).

  • Trevel (unregistered) in reply to ObiWayneKenobi
    Nevermind that all of these stories that feature a so-called guru in Language X always ends up with the person writing shitty code.

    Uh, dude? Check what site you're on -- ALL the stories here end up with people writing shitty code. (Or some sort of hardware/management failure.) If you heard that some guy was a code guru in Language X and checked his functions and they were awesome, your story would not be told here. You'll have to go to AwesomeCodeStoriesForAwesomeCodeGurus.com to find that sort of story. Or more likely you'll find a DNS error (or if your ISP is evil, a search page -- which ought to be punishable by death)

  • joe (unregistered) in reply to Procedural

    And if that's how you write English, I'm glad I've never run into your code.

  • joe (unregistered) in reply to joe

    ... I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English. ...

    And if that's how you write English, I'm glad I've never run into your code.

    Stupid Muphry's Law.

  • (cs)

    Yes yes. PHP clearly sucks. That's why no major sites use it.

    Or is it just that it's easy to get started with and thus we end up with lots of bad PHP code?

  • (cs) in reply to Trevel

    But it doesn't have to be the guru writing shitty code, it could be someone else in the story

  • my name is missing (unregistered)

    An expert is anyone 40 miles from home. A guru is anyone you wish was 40 miles away.

  • (cs) in reply to strictnein
    strictnein:
    Yes yes. PHP clearly sucks. That's why no major sites use it.

    Or is it just that it's easy to get started with and thus we end up with lots of bad PHP code?

    that's exactly it - PHP is easy to learn.

  • OldCoder (unregistered) in reply to Patrick
    Patrick:
    I once knew a programmer who would swear by his practice of prefixing all function names with A, B, C, depending on the order in which they executed in their main thread. If they called functions of their own, those would be named AA, AB, AC, BA, BB, BC, etc...

    And if both A_Something and B_Other called a common function, you would end up with AA_BA_Helper. Or AA_Helper and BA_Helper both calling _SHARED_Helper.

    This sounds like an old COBOL practice to me. I worked in a shop where 'goto considered harmful' so everything got performed...

    A-MAIN performed B_INITIALIZE, C-LOOP and D-TERMINATE and so on down to lower levels. We always seemed to end up with a paragraph called GAY-ABANDON, innocent days.

    Captcha: genitus. I'm almost afraid to ask...

  • anonymous_coder() (unregistered)

    You know, I've never understood the PHP-bashing. As an experiment, we wrote the same simple web app in Tomcat/Java, Python, and PHP. It took two weeks in Python - mostly fighting with the flash front-end. It took two days in PHP. And it took 5 days in Java.

    Frankly, crying about the language just means you lost your juicy contract to someone who undercut you on a web project proposal. I would never use PHP for anything other than web coding, but it excels at simple web applications.

  • (cs) in reply to Procedural
    Procedural:
    I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English.
    Well put. But what about the great washed masses? Let's not be exclusionary.
  • (cs)

    Ah, the old "I know what it means so it will always be good" syndrome. Not quite as bad as spaghetti code but pretty darn close.

    I've had the dubious pleasure of re-writing a bunch of procedures as we upgrade and have had to deal with half a dozen temp tables at a time, each with a primary key field name of .. id.

    I'd rant more but I'm the one who wrote them that way all those years ago. Now I can just shake my head and laugh. And be glad no one else has to deal with my stupidity.

  • Adam (unregistered) in reply to joe
    joe:
    ... I'm always impressed by the fact that people who say that PHP is a bad language, for it promotes odd inconvenient structures, is full of exceptions and incoherent rules, can be so readily abused, and therefore would and should be unpopular if it weren't for the great unwashed masses always choose to state those facts in English. ...

    And if that's how you write English, I'm glad I've never run into your code.

    Stupid Muphry's Law.

    /me wipes tears of laughter from his eyes. Can you not see the "Quote" button? How about the "Preview" button?

    Now, let us go to Wikipedia and learn of this man "Muphry"!

  • (cs) in reply to MrsPost
    MrsPost:
    I'd rant more but I'm the one who wrote them that way all those years ago.
    How long have you worked at the same place, Mrs. Post? Say hi to the mister for me.
  • Marcel (unregistered) in reply to MrsPost
    MrsPost:
    I've had the dubious pleasure of re-writing a bunch of procedures as we upgrade and have had to deal with half a dozen temp tables at a time, each with a primary key field name of .. id.

    Ok... and the problem is... ?

  • Arantor (unregistered)

    For those who bash PHP here, just note that this WTF could occur in just about any higher level language.

  • jDeepbeep (unregistered) in reply to jonnyq
    jonnyq:
    As someone whose main qualification is PHP, I can say that PHP is a bad language. It's a very bad language that can be written well if you try hard enough.

    Although it's not my only language, it is the most frequently encountered at the workplace on a daily basis, and... I must disagree with you saying 'it can be written well if you try hard enough'

    Any person with formal training in writing code, problem solving, and logic, can write correct and reliable code in PHP. It's not about trying hard enough. It's about good habits, code clarity, and consistency.

    Each language has its rough spots, so don't be a noob and imagine yourself above PHP. Fanbois < crackheads

  • (cs) in reply to Kazan
    Kazan:
    that's exactly it - PHP is easy to learn.
    I know not PHP, but it seems to me that PHP only appears to be easy to learn. Judging from the stories, learning to use it properly is not.
  • (cs) in reply to Arantor
    Arantor:
    For those who bash PHP here, just note that this WTF could occur in just about *any* higher level language.

    It's the way PHP handles form data that causes these issues. Everything is dumped into a nice array (even though php has terrible arrays) and then you get to work with the data from there.

    Most higher-level languages make you do specific stuff on the back-end to process the data.

  • Jim Lard (unregistered)

    Ouch. Glad I don't write my PHP like that! Everyone knows the proper way to do things is:

    function evaluate($args)

    Called like:

    evaluate(array( 'arg1' => 5, 'arg2' => 'sheep', 'arg3' => 'wtf' ));

  • will (unregistered) in reply to snoofle
    snoofle:
    Kazan:
    that's exactly it - PHP is easy to learn.
    I know not PHP, but it seems to me that PHP only appears to be easy to learn. Judging from the stories, learning to use it properly is not.
    Like the saying goes. 10 minutes to learn a lifetime to master.
  • jDeepbeep (unregistered) in reply to snoofle
    snoofle:
    Judging from the stories, learning to use it properly is not.

    I would say this is an incorrect conclusion. Because people shoot at other people with guns by accident, does not mean that this could not have been prevented/occurrences reduced by a brief 20 minute class on weapon safety. Of course, even if an individual took such a class, does not prevent them from shooting someone again. At this point in the story, I prefer strict typing in a language, and a ruthlessly critical compiler.

  • (cs) in reply to Trevel
    Trevel:
    Or more likely you'll find a DNS error (or if your ISP is evil, a search page -- which ought to be punishable by death)

    Yeah, or at least severe forms of torture. public DNS FTW.

  • jDeepbeep (unregistered) in reply to Satanicpuppy
    Satanicpuppy:

    Hey, are you also satanicpuppy on /. ?

  • noob (unregistered) in reply to jDeepbeep
    jDeepbeep:
    Each language has its rough spots, so don't be a noob and imagine yourself above PHP. Fanbois < crackheads

    Are you making fun of my name? That's not nice.

Leave a comment on “Can You Say Your $a, $b, $c's?”

Log In or post as a guest

Replying to comment #:

« Return to Article