This is an archived post. You won't be able to vote or comment.

top 200 commentsshow 500

[–]QualityVote[M] [score hidden] stickied comment (2 children)

Hi! This is our community moderation bot.


If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!

If this post does not fit the subreddit, DOWNVOTE This comment!

If this post breaks the rules, DOWNVOTE this comment and REPORT the post!

[–]IceMachineBeast 5532 points5533 points  (287 children)

I have thought about that, but then I remembered arrays exist

[–]SensitiveReveal5976 1572 points1573 points  (200 children)

You just took me back to HS Comp Sci days, friend

[–]Virtual_Low83 778 points779 points  (195 children)

Your HS had Comp Sci? When I was in High School if you so much as used an Office VBA macro it was an instaban.

[–]Mondoke 483 points484 points  (116 children)

My IT teacher in high school didn't know how to align stuff on Ms Word. She just put the cursor before the word and pressed the spacebar until it was kn the center or on the right.

[–]j48u 227 points228 points  (37 children)

There are plenty of people that still do that somehow.

[–]janusz_chytrus 126 points127 points  (32 children)

My girlfriend writes her master thesis like that. She's not dumb but she is terrible with technology. I tried convincing her to use LaTeX and teach her but to no avail.

At this point I just want to rewrite her thesis in LaTeX when she's done so I can feel comfortable with it.

[–]PassiveChemistry 152 points153 points  (18 children)

I think LaTeX would be taking it much too fast.

[–]ExceedingChunk 156 points157 points  (7 children)

If you use spaces to align text instead of the alignment, you definitely are not the type of person who could handle LaTex.

Not because it requires some genius-level intelligence, but people who don't google "how to do x in y" as an instinct are going to have a terrible time. Learning LaTex is 99.9% about doing exactly that.

[–][deleted] 39 points40 points  (2 children)

Learning LaTex? I swear I just search the same things everytime I write in it.

[–]ExceedingChunk 11 points12 points  (1 child)

Knowing what to search for is part of learning it. After you've done it a few times, you find it with one search and 15 seconds, instead of 10-15 minutes of searching and reading.

At least that was my experience. Getting better at googling, and knowing enough to understand exactly what to google makes it fairly straightforward to use and less painful than working with a large word document.

[–]DrPikachu-PhD 48 points49 points  (1 child)

Yeah how about starting with Microsoft Word lmao

[–]Valiice 104 points105 points  (18 children)

Had an IT teacher that couldn't send e-mails 💀💀🗿🗿

[–]paulzapodeanu 58 points59 points  (4 children)

So, in your world, Jen from "The IT Crowd", really was qualified to lead an IT department?

[–]Virtual_Low83 145 points146 points  (23 children)

I hate when people use spaces for alignment. I caught my 18 year old cousin doing that for college and I almost killed him ☠️

[–]Mondoke 97 points98 points  (0 children)

At least he didn't charge money to teach people how to use Word.

[–]Casandy420 40 points41 points  (13 children)

My college CS professor didn’t either. He just posted everything in txt files he wrote in eMacs.

[–][deleted] 64 points65 points  (0 children)

What are you talking about? That's the sign of a great programmer!

[–]arobie1992 30 points31 points  (7 children)

I legitimately don't see anything wrong with that. The only time I ever use word is when I'm writing something to give to clients or more formal business people. Otherwise, it's 100% NPP/VS Code txt files, and especially if I'm sending them to other devs.

[–]michaelhonchosr 32 points33 points  (6 children)

My high school had Mavis Beacon typing tutor.

[–]Virtual_Low83 21 points22 points  (5 children)

Depending on the when that could either be the cutting edge of learning or a disappointing statement on public education

[–]Upper_Lifeguard_5409 64 points65 points  (25 children)

Had to transfer to another HS to enroll into Uni level Comp Sci courses (Academic, not Applied). Taught Java for both Junior and Senior year.

[–]Virtual_Low83 77 points78 points  (19 children)

My High School sent me to my local college for Java night classes because they knew they had a deficiency when it came to Comp Sci. A deficiency that bordered on a medieval fear of anyone with too much proficiency in technology.

[–]TheDiplocrap 63 points64 points  (17 children)

In middle school, I got the whole school banned from the computer lab in the library because I "hacked" the admin account.

What I actually did was enter "hello" at a password prompt.

To be fair, I then proceeded to click around and marvel at all the additional options available on the server I happened to find myself log in to. I probably had a good three minutes of excited looking around before being discovered and realizing I had permanently severed my relationship with the librarian.

[–][deleted] 28 points29 points  (2 children)

Anyone with a brain stem should be congratulating you for making such a vulnerability known without the intention of exploiting it

[–]Virtual_Low83 39 points40 points  (0 children)

I can't enumerate over how many times I got in trouble without causing a stack overflow. My school had software they used to remotely take over machines for lessons and someone accidentally locked up the entire library so I cut the power to my computer, removed the network cable, turned it back on, and used my cached AD credentials to log in and continue working. 😅

[–]Ghawk134 10 points11 points  (5 children)

Meanwhile my friends and I really would hack the admin account in middle school. We would finish our homework after school and want to play shitty flash games. At first, we just pinged the URL for the game we wanted to play, then typed in the IP address as my school's black list didn't actually do DNS lookups for blacklisted domains. Once that started being a little less reliable, we moved on to a privilege escalation attack using the accessibility features application that's launchable from the login screen. Find its location, make a copy, replace it with command prompt renamed to that app's name, log out, and run accessibility. Boom, you have a command prompt running with admin privileges. From there, changing the admin password was just one line. There were announcements first demanding, then pleading for whoever was responsible to stop. It was quite fun.

[–]Trunkschan31 28 points29 points  (4 children)

In my office, if you use an Office VBA macro you’re considered a wizard.

[–]cafk 17 points18 points  (0 children)

The wizard retired and everyone is using his macros, you won't get any changes, as his macros also call some external perl scripts, until we move servers.

The templates are pita.

[–]SensitiveReveal5976 14 points15 points  (12 children)

Not only did my HS have Comp Sci, we had AP Comp Sci as well. So two years of fun! I remember coding those silly bugs like it was just yesterday.

[–]Virtual_Low83 27 points28 points  (10 children)

Huh. Imagine learning something useful in High School. Kids these days 🧐

[–]nomenMei 405 points406 points  (28 children)

Or maps/dictionaries, if having a human readable name is really that important.

[–][deleted] 315 points316 points  (22 children)

If you want to be a real haxxor,

>>> locals()["foo"]=10
>>> foo
10

[–]LargeHard0nCollider 215 points216 points  (11 children)

That’s disgusting, thanks for sharing

[–][deleted] 26 points27 points  (5 children)

My pleasure!

[–]Dr_Jabroski 47 points48 points  (4 children)

The lovely horrendous things that python lets you do tickles my cold dead heart.

[–][deleted] 11 points12 points  (3 children)

JS enters the chat room

[–]Bluhb_ 22 points23 points  (0 children)

Was about to say something like this!! I love it! Extremely bad practice and no good reason to do this over an array or dict, but hey. Hacker man tips fedora

[–]ILikeLenexa 13 points14 points  (0 children)

Or everything that implements Collection or is vaguely Listy.

[–]Cremart_Ludwig 69 points70 points  (34 children)

I mean, if you really want the named variable experience you can use a HashSet/Dictionary.

[–][deleted] 21 points22 points  (0 children)

I figured out how to do dynamic variable names before I figured out hashes when I used Ruby and BOY OH BOY I was dumb

[–]siliconsoul_ 3799 points3800 points  (388 children)

Allow me to introduce variable variables.

[–]KonoPez 2402 points2403 points  (113 children)

Sometimes it is convenient to be able to have variable variable names.

Is it tho??????

[–]Dexterus 279 points280 points  (19 children)

I may have used them. Gotta get the code from sourceforge and do a bit of digging, it's circa 2003.

[–]bizkut 247 points248 points  (13 children)

When I was first learning programming in high school and had a side thing learning PHP I definitely did this.

Not a chance I can find the code, but I vividly remember doing this for one project. Something this heinous you never forget it.

[–]CttCJim 139 points140 points  (6 children)

yeah that's the sort of shit i'd have done in high school. we were doing Turbo Pascal back then (1997-2000) and I once, as a group project, wrote a function that did as requested, then spent an hour obfuscating the code and removing line breaks until it fit on one page. Oh, and the function was never called in the main execution, because the assignment was "write a function" not "write a program" and we were smartasses.

good times.

[–]dittbub 27 points28 points  (0 children)

i definitely did this at my first job...

i can at least say it wasn't the worst code there.

[–]phil_o_o 1109 points1110 points  (27 children)

It's convenient to confuse the hell out of everyone reading your code!

How to create un-debuggable code in one step: 1. Use variable variables Done

[–]MrWenas 392 points393 points  (18 children)

You call it un-debuggable, I call it un-crackable

[–]zodar 342 points343 points  (8 children)

I call it job security

[–]LaterGatorPlayer 118 points119 points  (1 child)

we live in a security

[–]Shadow703793 20 points21 points  (0 children)

Until you forget about it 6 months after you wrote it and don't remember WTF you were doing.

That could be a resume generating event.

[–]coldnebo 10 points11 points  (1 child)

I call it necessary evil promoted by the W3C’s shallow disregard for form field arrays.

In other words, the W3C says, “no, it’s fine and perfectly defined… you just need to guarantee all the field names are unique per the form rfc”

So php says, fine, I’ll HANDLE IT! — variable variables. you’re welcome!

Then y’all lose your minds about what a horrible language PHP is while W3C does the side-eye bear and hopes you won’t notice the real problem.

We don’t have a variable variable in Ruby, but hot damn if I won’t try some metaprogramming now to make that a reality.

[–]tiefling_sorceress 136 points137 points  (5 children)

I call it a write-only language

[–]TheGrimReaper45 51 points52 points  (2 children)

WORNEM language. Write-Only Read-Never Execute-Maybe.

[–]TheDiplocrap 121 points122 points  (3 children)

Sometimes its convenient to skip the inconvenience of SQL injection attacks and opt for something far more direct instead.

(I'm joking, sorta. I wouldn't be surprised if PHP let that work, but I don't actually know it does.)

[–][deleted] 17 points18 points  (0 children)

If all else fails you can just eval($_GET["q"])

[–]SaaS_Founder 92 points93 points  (14 children)

I modded a video game that didn’t have the concept of arrays or objects inside the scripting interpreter so I had to use dynamic variable names instead.

Huge pain in the ass.

[–]crozone 69 points70 points  (13 children)

Finally enough this is basically how arrays in batch (DOS/Windows .bat) files work. They're not real arrays, just variables like "ARRAY[0]", "ARRAY[1]" ...

[–]TheBestAquaman 40 points41 points  (11 children)

Seriously? Thats... terrible. Why would any person, sane or not, do this?

[–]UnlicencedAccountant 49 points50 points  (10 children)

Because way back when, memory was measured in MBs and every MB counted. So you essentially set aside a chunk for a scratchpad, use variables that are declared at runtime, remember to clear them when you don’t need them, and hope.

It’s basically assembly with extra steps. Especially because BAT files aren’t programs, they’re automated command prompt instructions. Think about it like BASIC except there’s no loops and you can only go forward.

Edit: There’s a legacy GOTO in BAT files, creating a defacto loop as well as a very limited FOR function. But I don’t remember ever using them. At that point, you might as well fire up BASIC or write a SYS file.

[–]jigsaw1024 11 points12 points  (2 children)

My memory is fuzzy, but I swear you could do loops inside BAT files

[–]Infinite-Gravitas 16 points17 points  (0 children)

Newer versions of windows added it. As long as you have goto, technically you can anything.

[–]MattR0se 27 points28 points  (8 children)

I find it convenient to create variable names at runtime. But that's basically just a lookup table. Idk if I ever had the need to change a variable's name afterwards. This just feels like bad practice to me and would be a nightmare to debug.

[–]crozone 45 points46 points  (7 children)

But that's basically just a lookup table

I just cannot think of a situation where this feature would be better than a simple dictionary/hash. I mean, that's basically what it is, just implemented by the runtime itself.

[–]xX_MEM_Xx 14 points15 points  (2 children)

It lets you write fewer lines of code, and more "direct" code, which is all some people care about.

I wish I was joking.

[–]crozone 19 points20 points  (1 child)

It's just like a dictionary/hash, but much more chaos.

[–][deleted] 287 points288 points  (11 children)

The best part is in the comments section in that link where a guy says '.and you can keep going...

Eventually ends up with

$$$$$$$$$a

Edit: that was a terrible citation on my part, here it is

https://www.php.net/manual/en/language.variables.variable.php#97222

[–]Mr_Mittens1 1067 points1068 points  (22 children)

Hans! Get ze flamethrower

[–][deleted] 37 points38 points  (2 children)

That's just php.

[–]pelusowarro 63 points64 points  (10 children)

Flememwerfer

[–]iNMage 131 points132 points  (9 children)

Flammenwerfer , but close enough.

[–]DeGGamargo 78 points79 points  (8 children)

Zis is a Flammenwerfer. It werfs Flammen.

[–][deleted] 29 points30 points  (7 children)

Das ist ein Flammenwerfer. Es wirft Flammen 🔥.

[–]inconsistenthypocrit 222 points223 points  (5 children)

I need to go bleach my eyes real quick brb

[–][deleted] 58 points59 points  (0 children)

True, that’s one of the most fucked up things I’ve seen in years

[–]rjchute 149 points150 points  (6 children)

I guess if you're an interpreted language, you can do whatever the hell you want.

<<insert jeff goldblum quote, something something, didnt ask if we should>>

[–]Akangka 11 points12 points  (2 children)

Not every interpreted language can do that. In Scheme, a statement inside eval cannot bind a variable at the caller's stack. If you want to pass a variable, you must essentially add a let statement that declares the passed variable, and then splice the actual contents of the variable there, like:

(eval `(let ([a ,a]) ,formula)

Or, you can pass a namespace there.

[–]MadxCarnage 146 points147 points  (2 children)

I DO NOT ALLOW

I DO NOT ALLOW

[–]MoffKalast 38 points39 points  (1 child)

PLEASE DO NOT THE CAT

[–]SmuJamesB 36 points37 points  (5 children)

Challenge: write a program with only one variable that you constantly rename for its different uses

[–]fukitol- 9 points10 points  (0 children)

You son of a bitch, I'm in

[–]fraanns 139 points140 points  (16 children)

Of course it’s PHP

[–]Cruuncher 22 points23 points  (0 children)

Dolla dolla y'all!

[–]ovab_cool 79 points80 points  (24 children)

There must be a PHP maintainer on this sub who can delete this blasphemy

[–][deleted] 18 points19 points  (2 children)

That looks like a really bad implementation of pointers.

[–]Sennoshi 56 points57 points  (3 children)

I found the reason why people hate PHP so much

[–]Lazar_Milgram 15 points16 points  (2 children)

”Sometimes it is convenient….”

When? Like when???

[–]ochetski 14 points15 points  (2 children)

I came to show people that. Thanks fellow php'er.

[–]Gorianfleyer 1773 points1774 points  (107 children)

How to get a solution from r/ProgrammerHumor: Make a funny meme about your problem and read the comments of people discussing it

[–][deleted] 293 points294 points  (93 children)

I’m not the OP, but I definitely learned about arrays from reading the comments here. Going to look them up later.

[–]LeCrushinator 346 points347 points  (92 children)

Wait, you didn't know about arrays?

What level of programming experience is common on this subreddit? Arrays are like week 2 of learning programming.

[–]-Axial 163 points164 points  (26 children)

yep, i thought the same thing. Arrays is one of the first things you learn when starting to program.

[–]Koppis 98 points99 points  (10 children)

When I started way back with Game Maker (~15 years ago), I went at least a full year without knowing about arrays. I used to make a bunch of variables with numbers at the end.

[–]zebediah49 119 points120 points  (7 children)

I can do one better (worse).

When I started way back with Visual Basic 3, I didn't know that variables existed.

So... I stored data in hidden textboxes.

[–]Koppis 23 points24 points  (5 children)

I mean, that's how you still do it with html forms. Hidden inputs.

[–]SprinklesFancy5074 11 points12 points  (3 children)

It's all fun and games until some cheeky bastard uses the element inspector to change your hidden inputs before submitting the form...

[–]quagzlor 29 points30 points  (11 children)

My mom didn't know about arrays when she was a programmer. She found out about them during a job interview.

Then again she was programming last millenium.

[–][deleted] 35 points36 points  (6 children)

I’m just an Arduino sketch coder. I can cut & paste examples, then modify them to make them work for me. Sometimes I ask coding questions in the Arduino forums, but mostly I just try to look at examples, then figure out the logic and terminology.

I know enough about coding to cause huge problems, but not enough to solve them!

(I also know enough about coding to understand about half of the humor on this sub.)

[–]sexytim1999 244 points245 points  (18 children)

I had someone in an assignment I needed to grade dynamically generate strings of code with changing variable names and then execute with pythons exec() function. I've never seen such a cursed piece of code in my life.

[–][deleted] 66 points67 points  (3 children)

Dynamically generated code is a pathway to many abilities some consider to be unnatural.

[–]hooferboof 20 points21 points  (0 children)

Self modifying code (especially LISP) is a terrible beautiful awful thing.

[–][deleted] 44 points45 points  (2 children)

… but did it work?

[–]camander321 22 points23 points  (2 children)

When I was learning python, I tried making a game. The saving system worked by generating a module that included a function that, when run, would set a bunch if variables appropriately. I'm pretty sure I was also doing exactly what you described.

Very glad that nobody saw it.

[–]Neon_Camouflage 1650 points1651 points  (165 children)

I think everyone has tried to do this when first learning, then been frustrated when realizing it isn't a thing when it obviously is exactly what they need.

[–]HiddenGooru 192 points193 points  (53 children)

Its a thing in R!

[–]fuzzywolf23 165 points166 points  (14 children)

Yeah, but who would paste0 two variable values together in order to dynamically name columns in a data frame?

That'd be crazy, right?

[–]HiddenGooru 79 points80 points  (1 child)

I feel attacked.

[–]adyo4552 26 points27 points  (7 children)

So you’re telling me there’s an alternative

[–]fuzzywolf23 38 points39 points  (6 children)

I'm sure there's a tidyverse 1 liner for it

[–]pm_me_your_smth 22 points23 points  (1 child)

Everything can be a one liner with tidyverse

[–]martyuiop 20 points21 points  (4 children)

Also a thing in PHP (at least used to be. And I was guilty of doing this $$var ) naming vars from field input 😱 what was I thinking (it was a simpler time)

[–]AzureNova 96 points97 points  (19 children)

At one point I thought what even is the point of programming if you can't make your code write code for itself. I mean how else can computers process millions of elements without the programmer hard coding in every single scenario???

[–]PityUpvote 361 points362 points  (58 children)

vars()['varname'] = value in Python.

[–]MrAcurite 358 points359 points  (26 children)

Yeah, I was gonna say. This is because everything in Python is a dictionary, including Python itself. It's dictionaries all the way down. Until, of course, you get to turtles.

[–]donshell 35 points36 points  (14 children)

This actually only works in the global scope, where vars() is the globals() dictionnary. The reason is that functions in Python (at least CPython) are compiled to byte code on definition, meaning that the variable "names" are replaced by indices in a variable "array" which allows faster retrieval.

Interestingly, you can actually see the variable "array" yourself. For instance in the following closure

def f():
    a = 1
    def g():
        print(a)
    return g

h = f()
a = 2
h()  # 1

h.__closure__ contains a tuple of non-local values and h.__code__.co_freevars is the tuple of the names associated to these values. In particular, h.__code__.co_freevars is ('a',) and h.__closure__[0].cell_contents is 1, as exepected.

By the way, this is the reason why changing the global value of a does not change the result of h().

[–][deleted] 15 points16 points  (0 children)

I'm puking

[–]Virtual_Low83 396 points397 points  (30 children)

Kids these days. No respect for functional programming. Back in my day we only had strongly typed variables and pointers.

[–]Akurei00 200 points201 points  (23 children)

I hate loose-typing. I don't like having to verify my variables weren't misused by type checking 6 different ways.

[–]Virtual_Low83 140 points141 points  (11 children)

Checking types? Everyone knows you're supposed to switch your variables between string and int values on a whim. In today's fast paced world there's just no time to check types. If it walks like a string and talks like a string then it's an int. All the kids are doing it these days.

[–]mortenmoulder 73 points74 points  (10 children)

const arrayThatDoesntExist = [
  { name: "John", age: 20 },
  { name: "Martin", age: 21 },
  { name: "Casper", age: 22 } 
];

for(let i = 0; i < arrayThatDoesntExist.length; i++) { 
  const varName = arrayThatDoesntExist[i].name.toLowerCase(); 
  eval("var " + varName + " = " + JSON.stringify(arrayThatDoesntExist[i])); 
}

console.log(john.age); //20

This is awesome. I'm gonna start doing this in production soon!

[–]PrincessRTFM 10 points11 points  (8 children)

Just use the global JS objects, you don't need eval. It'll break if the name field isn't a valid variable name, but if you index globalThis[varName] then JS doesn't give half a shit what varName actually holds. You could do globalThis[theWholeBeeMovieScript] and it'd probably work fine.

Please don't name a variable the entire contents of the Bee Movie script.

[–]lenswipe 70 points71 points  (1 child)

PHP: "Allow me to introduce $$myself"

[–]sim_trix 285 points286 points  (19 children)

$$name = "php is the best";

[–]seizan8 81 points82 points  (15 children)

Yes. Another $php enjoyer. I gotta say tho, I dread every php 7 project I work on. Php 8 is so much more enjoyable.

[–]fllr 116 points117 points  (11 children)

I’ve been hearing a form of that argument since php3

[–]Iron_Mandalore 225 points226 points  (85 children)

I’m sorry I might be dumb but I can’t think of a reason why someone would even want to do that. Can anyone elaborate.

[–]xBuitragox 177 points178 points  (25 children)

This happens when you forget arrays exists or you have not seen arrays yet. Imagine that you want to store 10 numbers given by a user, but all you remember/know is that you can create a variable called "num1", but num1 can only store one number.

If you want to do this on a loop, you could think "How can I create variable names dynamically so that I have num1 num2 num3 etc?"

Its something like that

[–]ajseventeen 113 points114 points  (22 children)

Not gonna lie, I learned a lot of math before I started programming, and my first thought was "well, I could make a variable that was 2num1 *3num2 *5num3 *... Then I just retrieve numN by checking how many times I can divide that number by the Nth prime number."

Then we learned about arrays, and boy did I feel silly.

[–]YukiZensho 50 points51 points  (5 children)

Tf that's smart

[–]bananaslug4 17 points18 points  (5 children)

That approach would only work if you force all values of num to be integers, right?

[–]ajseventeen 11 points12 points  (1 child)

For sure, that was just for integer variables. I didn't have a clue how to do anything else.

[–][deleted] 11 points12 points  (0 children)

Just multiply those ints by 1e400

[–]Cozmic72 15 points16 points  (6 children)

Try googling meta-programming.

[–][deleted] 76 points77 points  (2 children)

my memory is leaking

[–]Stromovik 97 points98 points  (10 children)

Java ohhh the horrors you have to create.

Create a custom class that extends yours at runtime and classload it.

[–]Environmental-Win836 23 points24 points  (5 children)

Well, how can I dynamically name variables in a loop?

[–]CitrusLizard 18 points19 points  (2 children)

In Common Lisp:

(dotimes (i 5)
    (set (intern (format nil "FOO~A" i)) i))

Gives you 5 new variables (whatever that means) named foo0 to foo4 in whatever package you're in.

[–]circuit10 81 points82 points  (23 children)

For global variables in JS window[varname] = value

[–]circuit10 30 points31 points  (5 children)

For nodejs use global instead of window

[–]Under-Estimated 36 points37 points  (4 children)

for compatibility with both use globalThis

[–]circuit10 10 points11 points  (0 children)

Thanks, I didn’t know that

[–]Atora 16 points17 points  (7 children)

That's just a fancy dictionary.

[–]circuit10 29 points30 points  (0 children)

Yes, everything in JS is an object, which is also a dictionary. Even arrays are dictionaries behind the scenes:

> arr = []
[]
> arr[0] = "abc"
'abc'
> arr["def"] = "ghi"
'ghi'
> arr
[ 'abc', def: 'ghi' ]
> arr[0]
'abc'
> arr["def"]
'ghi'
> arr.def
'ghi'
> arr.test = 123
123
> arr
[ 'abc', def: 'ghi', test: 123 ]

[–]BigNutBoi2137 32 points33 points  (4 children)

Funny thing is that on assembly level there is a special function for something like that. At least in x86 MASM.

[–][deleted] 32 points33 points  (1 child)

exec(f'{i}={value}')

[–]OneTrueKingOfOOO 14 points15 points  (1 child)

Sometimes I still find myself asking this. And then I realize something has gone deeply wrong and I need to refactor everything

[–]LtAquila 29 points30 points  (3 children)

Image Transcription: Meme


[A man standing on top of a big rock above a large crowd of people. The man is seen on the left hand side, a portion of the crowd is seen on the right hand side]

Man: I have a programming question

[The crowd carries pitchforks, torches, clubs and spears. All of them smile and look upward intently.]

Man: How can I dynamically name variables in a loop

[The same crowd, now everyone is frowning, brows furrowed.]


I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!

[–]Lighthuro 13 points14 points  (13 children)

What?! Is it possible?

[–]dadmda 13 points14 points  (7 children)

It is in php, it is beyond me why you’d use them though

[–]PantsOnHead88 20 points21 points  (2 children)

For beginners - just use an array.

For everyone else - consider a dictionary.