- 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
We know. That's more or less the rationale behind the language.
Admin
That's why I modified his code to use func_get_args, and used variable variables. It's way more WTFey they using call_user_func.
As an additional WTF, in PHP you can't create a variable with a number at the start. However, in a variable variable, you can.... oh, and not then be able to reference it. Unless you write something that uses a variable variable as a reference. I wish I was making that up.
$var = 1; $$var = 'test'; echo $1; //parse error echo $$var; //test
Admin
This. This. A thousand times this. It's not fucking clever.
Admin
Just to point out, this exists within the SagePay integration examples along with a whole lotta other wtf.
Admin
Ahem... I totally misread that...
oh the shame
sob
Admin
$ cd project $ tar -cxf ../project_backup.tgz . $ for thing in
find . -type f -name "*.[pP][hH][pP]"; do cat $thing | sed "s/oldfn/newfn/g" > $thing.longer;mv $thing.longer $thing;done $ cd .. $ mkdir compare $ cd compare $ tar -xpf ../project_backup.tgz $ diff -r project ../project^---or similar should do it. (The regex may need a bit of tuning.)
Any decent IDE worth it's salt (or eclipse if you must) will do a similar kind of search and replace.
Learn to use tools properly and extra function calls really aren't needed.
Admin
Admin
Good point. Thanks for clearing that up for me.
Admin
Please to reset your sarcasm detector.
Admin
"And in the end it turns out they actually needed a variant of base64. "
Been there, done that. The correct thing to do, though, is to give it a generic name rather than citing a standard that you're not adhering to.
Admin
Oh, all right. I would like to introduce a motion that we withdraw the armed guards who force this poor gentlemen to visit this site three times day, and that we discontinue the beatings and torture when he fails to do so.
Admin
There are definitely reasons to wrap functions in PHP. For example, the Drupal CMS wraps all string functions to add fall-back multibyte handling in environments that have no mb extension installed.
But if an abstraction layer doesn't do anything, then it is a stupid programming error as it makes a program slower, larger and less maintainable for no benefit. The notorious mess is not PHP, but the result of developers like this using it.
Admin
Yes, variables do need to be initialized, especially in a world of register_globals. But this doesn't make sense in any world:
Even if the first line is omitted, the second line ensures that any prior value of $output is overwritten.
Now go see the original code snip: Just doesn't make sense, does it?
Addendum (2012-02-25 17:44): Oh, and by the way: Why even have $output when you can return the value directly, as in my example?
Admin
You have got to keep the code slow, otherwise people will stop wanting to upgrade their hardware. If this were not the case, why would .NET exist?
Admin
Admin
actually this wouldn't be so much of a WTF if this guy made an encryption class to wrap all encryption methods in it for coding speed/maintenance like: $wtf0 = PhonyEncryption::base64Encode("usitas (askimet)"); $wtf1 = PhonyEncryption::rijndael256Encode("usitas", $key);
Admin
you dumbass. the .net is the best and fastest thing ever invented in that category.
Admin
Does anyone else ever find themselves doing this for things like console.log in JavaScript? The infuriating disasters that follow ever being in a browser that doesn't declare the console object are such that I usually wrap them to make sure my code fails gracefully if/when a browser throws a hissy fit.
Admin
Admin
I have seen so many crap sites in ASP.net, most of the time i find websites in ASP.net horribly slow (Especially when they are using webforms), sometimes because of the _VIEWSTATE string theres like a few hundred kilobytes, i suspect.
Stuff rarely works as intended with webforms (Mostly because some ASP.net developers think that their framework is so great that they dont need to think for themselves), i have seen too many sites with webforms that breaks every rule of usability, like you hit enter in a searchfield and get an error about not providing the propper credentials for a login, because all the shit is thrown in one form - I know that you can do several forms with webforms, but it seems like most ASP.net developers dosn't.
Im getting kind of tired of the PHP hate, yes its inconsistent in naming conventions, has a handfull of quirks (Like boolean comparison), but when you haven't used it since PHP3 then please do shut the fuck up, or at least provide a better AND fresh argument.
"I used ASP.net 2.0 it was crap, asp.net is crap!"
Not really a good way of making your point is it?
Admin
Just to support my argument regarding __VIEWSTATEs:
294KB viewstate, u mad ?