- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Article's taking forever to load, but what I have so far is already bad enough.
"The Helpful Customer"
Admin
I'm not familiar with the colon/semicolon syntax used with the if/else there...maybe that's a good thing...
Admin
If the thing, then write the other thing, otherwise write the same other thing? Oh right, you're supposed to just write the other thing, and comment out the old code!
Admin
Admin
:baby:: Isn't that the same thing?
Admin
Touche, salesman....
http://profile.ak.fbcdn.net/hprofile-ak-snc4/50275_273661609890_4349486_n.jpg
Admin
So it's also looking at a different variable?
Admin
A variable which does the opposite of the other one,
apparentlyI hope.Admin
Even better, "PHP-based" is unicorns and rainbows.
Filed under: Of all the places to put the link...
Admin
I'm surprised that you're surprised...
Admin
I had a moment of I didn’t know you could do that!
I share your sentiment. I haven't seen alternate PHP syntax in the wild for more than five years, if ever. They kept it in PHP 7, so it can't be wholly irrelevant though.
Admin
I think we're lucky that the condition body didn't contain the entire HTML form, best with tons of ECMAScript.
Admin
I use it as a (poor man's) templating language.
To me it's clearer to end the loop with
endforeach
, especially when there's a lot of HTML to print.Admin
Well, what is the number? Is he surprised that it's so low or so high?
Admin
:scream: using PHP for its original purpose.
I agree that under those circumstances an explicit
endforeach
is clearer than a mute}
.Admin
I think WordPress still uses it and actively promotes it in their development guides. Saying that, the PHP code in WordPress is pretty shocking in a lot of places, so I'm not surprised they're using this awful syntax.
Admin
Dare I ask at what point
if($can_submit)
got changed toif(!isset($a3))
?Admin
FTFY
Admin
Yeah, I was only familiar with the
{}
syntax. But I'd put the spacing and indentation in the PHP, not in the output...Or... for a bit of HTML that small, I'd probably just use
echo
.Admin
Razor syntax (ASP.NET MVC) is so much cleaner:
Admin
Fuck ASP though. Can it even handle file uploads natively yet?
Admin
It's not ASP, it's ASP.NET.
ASP is like [image]
ASP.NET is more [image]
Admin
Danger, Will Robinson! Danger!
Admin
It's a newer, upgraded version of ASP, and that doesn't really answer the question I asked.
Admin
That's like saying Windows 10 is an upgraded version of MS-DOS.
And yes, ASP.NET can handle file uploads natively.
Admin
Good to know, I guess. My experience with ASP was when my college gave us free web space and only allowed ASP. While PHP lets you handle an uploaded file, no problem, everything on the internet for doing that in ASP was "purchase and install this or that third-party addon"...
Admin
My first job was with ASP, and I'll be among the first to claim that it's a total shitbag. Thankfully, within two years, I was working in ASP.NET (first WebForms, now MVC).
I'd rather commit seppuku than go back to classic ASP :smile:
Admin
Yes, ASP.NET can handle file uploads. Both WebForms and MVC handle them just fine. Source: me. I built plenty of sites with those fuckers, and it's always a pain when a user has to go through a multi-step process and the user has to upload a file at step 2.
And ontopic: this isn't too much of a WTF. The customer clearly said he "knows a thing or two about PHP" and he was able to solve the problem he was facing. For a non-programmer, I think he did a fairly good job. He probably looked at a different place where the
if
construct was used (or Googled it) and based his work off of that.Kudos to the guy for not accidentally breaking stuff because he missed a ?> or forgot to remove some brace, which would completely break his page.
Admin
ASP: http://media-2.web.britannica.com/eb-media/30/142430-004-C938E404.jpg
Admin
Until you do something it doesn't like with the spacing, and it can't decide which {}s are code and which are HTML.
That's my main beef with ASP.NET MVC. Well, that and the routing. Good luck figuring out why you can't hit your methods if the magic stuff doesn't work the way you expected.
Admin
Admin
Routing seems to be the normal problem with web frameworks. The order of the day with them appears to be almost always to tend towards being highly confusing…
I'm not sure that there's much that can be done about it other than adding some probably-even-more-confusing routing compiler to the mix.
Admin
Same here. It appears that "if condition, do X else do X" is a terribly a difficult concept for some "programmers.". Right up there with all those impossible-to-understand arrays.
,,,and indexes in database systems...and Boolean values.
Admin
Sometimes I do that with TODO comments and logging in either the if logic or the else logic as one of them requires components/controls/modules that is not done yet and I do not wish to break the program flow. But knowing some of my previous coworkers, they have the habit of removing my TODO comments and not implementing anything leaving me confused when I come across my own WTF.
Admin
Bob was trying things at random to get the button to show all the time. The "can_submit" function was just too much indirection for a brain to handle so he removed it and replaced it with its contents ("What's the point of a function that only has one line in it? That's a bit wasteful of resources"). And having done it, it was: "Right, now let's see how to get it to make sure that a3 is set all the time."
Took him a while to realise that he could use the "else" concept, by which time he had forgotten what the "isset($a3)" was actually for, and left it in just in case "isset" actually had side-effects that changed stuff.
Admin
When someone asks me "how do I do X?" (especially in PHP), and it's shortly followed by "Never mind, I figured it out myself." I know I don't really want to know how they figured it out.
Admin
That was painful to read. I'm sorry.
Admin
Just read the preview again:
Considering this, I expected something like a Code Zombie Apocalypse. Under this aspect, that if-instruction-else-sameinstruction construct is like a rotten slice of sausage in comparison.
Admin
I know a thing or two about medicine - I'll be taking care of your health care for the next few years...or maybe less.
Admin
So.. The client wants the submit button to appear all the time so he adds conditions to the already existing conditions? How about REMOVING THE CONDITIONS?
"I know a thing or two about PHP.." That should've rang a bell.. like a wedding in church .. with the trumpets of Jericho..
Admin
I'd like to see an equivalent to the Rails
rake routes
command that lists all of the routes in the app, what the URL, request type, and options are, and what controller and method it connects to. As it is now, if your routes aren't working the way you expect, there doesn't seem to be any way to debug what's going on, and you just have to guess and stab in the dark until it works.Seems like a strange world when C# is using more incomprehensible magic than Ruby.
Admin
This is why magic is bad. In many frameworks in various languages, you specify in code what route maps what url to what controller and method. Thus, you can find and debug it easily when there's a problem.
Admin
We mostly end up using the attribute routes in MVC, which is pretty much the same thing. About half of the headaches are from the auto-routes based on the controller and method, and the other half are from the too-smart-for-its-own-good attempts to map any kind of POST param to some kind of object, and to reject the route entirely if it can't figure out how to map whatever you POSTed at it to whatever the type of the method's parameter is, again with nothing helpful to debug.
Not sure if I'd say all magic is bad, but you should at least be able to debug into the magic and have clear options to override it when it doesn't do what you need.
Admin
If people don't even understand those simple IF-THEN-ELSE constructs, then how shall they understand those with FILE_NOT_FOUND?
Admin
This is one of the reasons why I generally dislike web frameworks (and hence got out of web development and hope to never go back). As far as I'm concerned, there's already a perfectly good framework for this routing stuff, with fancy Web 2.0 (TM) names like "web server" and "file system".
Admin
Really, PHP? :wtf: is wrong with you?
Admin
Isn't it simpler to ask what isn't wrong with PHP?
I'm asking for @arantor.
Admin
Poor man's templating language integrated with main language + syntax. It continues to be one of the most retarded parts of PHP.
Admin
It does get enough things right that it outpaced Perl for running sites, is generally quite sandboxed and predictable in its behaviour.
The problem is knowing all 3,742 gotchas to explain what that behaviour will be.
Admin
So...
Ingenious!