Story: What does strtolower do?
Gather round everyone, it's Story Corner Time! This story is from way back to my earliest of days as a full-time software developer. I was working for Sony Online Entertainment, which later became Daybreak Games Studio. But at the time it was an online PC gaming company that Sony bought and it made and maintained games such as EverQuest 1 & 2, PlanetSide 1 & 2, Star Wars Galaxies Online, Free Realms, and more. I've got tons of stories from my relatively brief tenure there but today it's just short and simple: who would win between a college-graduate computer science major and a single PHP function? Spoiler: it's not the college grad.
Within Sony Online Entertainment were different teams handling different "domains". One such team was referred to as the "Application team" and they built a applications primarily in Java (or at least that was the only language I ever witnessed them using, I didn't keep a record of every project they covered). And the manager for this team had like a Master's degree in Comp Sci or something, was a total snob about it, and would sometimes make not-entirely-subtle deriding remarks against me since I had dropped out of college to work full-time instead.
Well, we acquire a company that has some Facebook games which were becoming incredibly popular (read: profitable) at the time, but all of their stuff was in PHP. Well, the Application team needed to help support the transition of these applications under the Sony Online Entertainment umbrella. This led to a recent college graduate being assigned to do some simple but tedious grunt work.
Maybe it's because we happened to be the closest in age and relatively seniority within our department, but this programmer came to me one day saying they were running into a problem and they couldn't figure out what was wrong. My team did a lot with PHP, as well as languages like Java, C++, Lua, and more. I was young and foolish and more than willing to help, so I did, even though this person was making close to double my salary.
They are walking me through this code, most of which we acquired from this other company, and he's telling me what is supposed to be happening. Then we come across the problem: there's a block of code that should definitely be executing but isn't, and he couldn't figure out why. Here is what that line of code looked like:
if (strtolower($var) == "EXPECTED") {
// do a thing
}
For those not familiar with programming in general, or unfamiliar with common PHP functions, let me break that down for you. It'll only take a moment.
The word str
refers to a string, which is any set of characters. This whole post is one giant string, for example. Then you have "to lower" after that. So the function is effectively "string to lower" or, to expand that out, "string to lowercase". This means whatever string is stored in $var
is going to be converted to lowercase characters.
Even if you didn't have any reference for any of that, PHP used to (and probably still does) maintain excellent documentation about its standard library which was readily available online and even had a search function, meaning you could just copy/paste the function name and get the documentation for it without breaking a sweat.
And so I'm looking at this and I say to him, "do you know what strtolower
does?" And his actual response to me was, "No, I just copied it from Stack Overflow." At the time, Stack Overflow was new, it didn't contain the depth or breadth of knowledge that it does these days. But you could still find fairly answers to simple questions easily enough. And so I guess they used it to find a question similar enough to whatever problem they were having, they found a potential answer, they copied it into their code, and then just stopped thinking after that.
So I explain to him that strtolower
turns a string into all lowercase characters. And for a moment we just stare at each other, like he doesn't comprehend why I'm telling him that. Then I point to the expected value he's comparing $var
against: "It's all uppercase characters. You need to either convert the variable to all-uppercase characters or change EXPECTED
to all lowercase characters." So we changed it to expected
and re-ran the code and voila! Success.
To recap, this developer is a recent college graduate. He was offered almost double my salary as his starting pay. His boss frequently bashed me for dropping out of college while touting college as the penultimate form of education that produces superior workers. This college grad making almost double my pay came to me for advice for a problem that I identified immediately upon seeing the offending code.
As a bonus, I was interviewing for a job once and this same guy who used to be the Application team manager was working at that company. I had never been mean or confrontational to him during my time at Sony Online Entertainment so I figured I would see if he might give me a recommendation to the position. After all, he knew that I had helped his team a number of times, like in my story above, and so I figured he'd at least be feeling neutral toward me after years had passed.
But no, he was still a pompous asshat. Told me basically not to bother if I hadn't gone back to finish my degree because the environment was really competitive and I'd have difficulty rising within the company. And although I didn't get the job at that company, I wasn't too broken up about it. I've had a chance to work with some incredible people and also be a mentor to many others. I know my quality of work is high. I know I get my work done in a timely manner. I know that I'm no less capable having dropped out of college because it was boring as shit.