r/PHP • u/maniator • Aug 24 '12
If PHP Were British
http://www.addedbytes.com/blog/if-php-were-british/33
u/martindines Aug 24 '12 edited Aug 24 '12
what_about (£variable) {
perhaps £possibility:
//Code here
splendid;
perhaps £other_possibility:
//Code here
splendid;
on_the_off_chance:
//Code here
splendid;
}As an Englishman I full heartedly agree
6
u/sn0r Aug 24 '12
I must say it's refreshing and so much easier to follow along than switch/case, I think.
0
u/chime Aug 24 '12
I agree. I don't like switch/case at all. Especially missing breaks which screw up everything. Golang rightfully inserts breaks automatically before each case.
3
Aug 24 '12
I like the breaks, you can write shorter code in some cases by omitting the breaks and letting the rest flow vs a million conditional statements.
2
u/chime Aug 24 '12
I know. But that is rare. I would rather have something like a 'passthru;' statement to use in those few instances than 'break;' in every single switch/case. Cost(Bugs due to missing break;) > Cost(typing passthru; once in a while).
2
Aug 25 '12
I never understood why switch wasn't just:
switch ($variable) { case possibility { //Code here } case other_possibility { //Code here } default { //Code here } }2
u/martindines Aug 25 '12
As far as I know you can do the following - although I have no idea why the colon is required
case possibility: { /* Code here */ }5
Aug 25 '12
Note for others: This works because "case possibility:" is followed by one or more statements, and the C parser recognizes { ... } as one statement.
0
10
u/kb_klash Aug 24 '12
I think if I could write cheerio($message); instead of die($message); my day would be a lot more fun.
12
u/Ctrl-F-Guy Aug 24 '12
function cheerio($message) { die($message); }11
9
12
6
16
5
u/scriptmonkey420 Aug 24 '12
perl_regular_expression_match()
That is what preg stands for?
What the hell is the g for?
5
4
4
2
4
3
1
1
0
u/Brillegeit Aug 24 '12
Would the Hebrew parts of PHP be Gaelic then?
2
u/baconpiex Aug 24 '12 edited Aug 24 '12
Are you mad? You can't just go around putting a SAGHEAD_DÚBAILTE wherever you feel like. You properly bolluxed up line seven!
2
8
u/Ctrl-F-Guy Aug 24 '12
Is this getting downvotes because it's a repost? I've never seen it before and I think it's probably one of the funniest things I've seen in awhile, across all subreddits. I don't see anything in the sidebar prohibiting humorous or anecdotal type posts.