james, not that I am trying to convince you to change anything anymore. But there are a few points that need to be clarified because you just seem to have some misconceptions (understandably, since you don't seem to be very experienced or a professional):
The PHP also being one of factors why it had to be coded the way I was asking.
Poor design decisions on one end never
justify poor decisions somewhere else in the code. This is exactly what code smell makes you want to do, though. And in the end it's a spiral that at one point will make it impossible to change anything without breaking ten other things.
You also seem quite sensitive to the term "code smell". Maybe you're not familiar with it. It's actually a well-established term "in the biz".
You might not like my code, but I understand it,
Good. But for how long?
Sure you understand what you write while you write it, but try reading these things in a few weeks.
and more importantly it WORKS
No, not "more importantly". You should free yourself from this thought asap. Smelly code that doesn't work will at least give you a reason to improve it; smelly code that does work, however, invites you to keep making everything worse.
The fact that code works (as expected) should be a consequence of proper implementation, not the product of desperate attempts to somehow hack the code into something that probably does what it's supposed to do.
it works fast enough and works cross browser and on all devices I tested.
And given a proper implementation, so do the mentioned alternatives here. That is a 100% guarantee.
Why I'm so sure of it? Because the suggested changes are not functional changes. Names of variables, ultimatively, are irrelevant, so anything that I put into an array I can use just like variables. The difference is readability and maintainability.
There is a nice little rule in software development, the boy scout rule: Always leave code a little cleaner than the way you found it. In particular this implies not to make bad code worse.
Bad code, however, rots and keeps rotting with every smelly snippet of code you throw on top of it. This process can kill
a project. I should know, I deal with the remains of such a project everyday at work, only that it has 27 million customers.
All this being said, everyone has to learn. Maybe it's something to keep in mind for your next project, at least. I know how much it pains to make drastic changes. But maybe you'll understand some of what I'm trying to tell you.