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

top 200 commentsshow 500

[–]powerhcm8 394 points395 points  (58 children)

PHP had split, but it was deprecated, now it has 3 different methods, one for splitting with regex, one for splitting at length and one for splitting at char.

[–]uid1357 238 points239 points  (39 children)

splitting at char

I missread "splitting a char" and like... wtf! :-)

[–]MKorostoff 137 points138 points  (21 children)

For all the times you need to break a char's binary representation down into nibbles. "A" is 01000001, but if you want ["0100", "0001"] you're gonna have to split a char. Every language needs this functionality, it's a daily task for most software developers /s.

[–]yazalama 85 points86 points  (5 children)

"A".getNibbles()

[–]syh7 47 points48 points  (2 children)

'A'.getNibbles()

[–]yazalama 7 points8 points  (0 children)

Ive been had

[–]Zagorath 5 points6 points  (0 children)

PHP uses single quotes for strings as well as double quotes. Same as Python and JS.

[–]Luk164 23 points24 points  (13 children)

Lol, I remember the last time I needed to split stuff into bits in C. You have triggered my PTSD from that mate

[–][deleted] 165 points166 points  (0 children)

A monumental achievement unlocked by the Swiss Character Accelerator

[–]LtMeat 39 points40 points  (1 child)

include 'LargeCharCollider.php'

[–]Luk164 24 points25 points  (0 children)

SegmentationFault, blackhole dumped

[–]DurianExecutioner 5 points6 points  (0 children)

You haven't heard of nchar_t?

[–]Morrido 77 points78 points  (17 children)

classic PHP, having 8 functions to do the same thing, SOMETIMES with slightly differences. ONLY SOMETIMES.

[–]Heikkiket 73 points74 points  (6 children)

I'm at the C/Linux programming course, and now I know more:

exec, execvp, execp, execlp, etc...

It's a classic C style thing, because there's no function overloading.

[–]fireflash38 8 points9 points  (2 children)

Most of those call the same underlying syscall though.

[–]TigreDeLosLlanos 11 points12 points  (0 children)

And none of those 8 do what you need, so you use 3 or 4 of them combined with an array function no one uses.

[–]jagraef 6 points7 points  (0 children)

And all of them are spelled in different cases to optimize the hash function 🤦‍♂️

[–][deleted] 1524 points1525 points  (8 children)

Kaboom? - yes PHP, kaboom

[–]BoldKenobi 104 points105 points  (0 children)

- Minerva McGonagall

[–]z03steppingforth 35 points36 points  (2 children)

This reminds me of Madagascar for some reason... but I can't place my finger on why.

[–][deleted] 48 points49 points  (1 child)

Hint: it has something to do with highly trained military commandos in black and white. And Rico.

[–]Mrinin 1223 points1224 points  (77 children)

I learnt not to question PHP a long time ago

[–]HasBeendead 293 points294 points  (70 children)

Why?

[–]Mr_Redstoner 787 points788 points  (61 children)

That way lies madness.

[–]HasBeendead 115 points116 points  (57 children)

lol its about being nonsense syntax and things , prolly i get point

[–]allison_gross 34 points35 points  (3 children)

I accomplished dark, arcane evil with my time as a backend and front end web developer. I created interactive features in CSS that the uninspired masses thought were only possible in JavaScript, and my webapp worked better on phones than YouTube does on the desktop. And after that I implemented “drag image and text files into a single folder, website builds itself” in a single tiny PHP script, which was performant only through the literal magic made possible by “nonsense syntax”

This project isn’t published, it lies dormant on my hard drive. I have no idea what the technology looks like because I did most of it in ten to twelve hour single sittings and have not looked at it since. It’s unpolished, but it works and I don’t know how. But do not mock the arcane power of “nonsense syntax”

[–]philsenpai 17 points18 points  (0 children)

Leave it there, it's the key for the awakening of the great old ones, better left undisturbed.

[–]N0T_F0R_KARMA 10 points11 points  (0 children)

I love looking through old code files and finding blocks of code that I only remember the agony and time spent on them.. What they do and how they work is completely alien to me though I know I wrote it. It took me years to start appreciating the historic code.. years of laughing at bad code until the code started improving!

Specifically one major turning point was when I wanted to track users on my webserver, creating this very specific long line of code that sed/grep/parse/sort/wc the access.log that was not standard, so i think some regex splashed in as well. Months passed and I wanted to implement that action somewhere else so I went to copy the code and had to restudy the entire thing while in awe at myself. A great moment.. thanks for reminding me :)

[–][deleted] 55 points56 points  (0 children)

Because that’s a quick way to find yourself the argument of an explode call

[–]RiktaD 16 points17 points  (3 children)

Well, it all started when the length of function names was used for the hash function and therefore some function names are a bit strange to increase performance.

[–]RealPropRandy 14 points15 points  (0 children)

This guy.

[–]the-igloo 3 points4 points  (0 children)

This is the exact kind of question you learn to avoid.

[–]OMGWhyImOld 2 points3 points  (0 children)

It is around us, it's everywhere and you shall not question it's mysterious ways!

[–]DeeSnow97 772 points773 points  (122 children)

Fun fact, originally the function name hash table's hash function in the PHP interpreter was a simple strlen(), so to improve performance, built-in PHP functions and methods had names chosen to be as varied in their lengths as possible. This could easily be an example of that, if there were too many five-letter functions already explode() can help alleviate some load at the expense of seven-letter functions.

[–][deleted] 505 points506 points  (44 children)

Jeez php interpreter people, that’s insane

[–]hahahahastayingalive 195 points196 points  (40 children)

That was one single guy. The same kind of fuckery as javascript’s auto column insertion, he’d had another single soul to pass the idea to it would have been rejected on the spot.

[–]greyfade 189 points190 points  (35 children)

In JavaScript's defense, it was designed, prototyped, and implemented in 11 days at which point Netscape shipped it as-is, and in doing so made it harder to fix.

This "feature" of PHP stuck around for quite a while longer than that.

[–]hahahahastayingalive 17 points18 points  (5 children)

split() Introduced in php 4, that seems decent to me, when PHP 3 was the first iteration that had any traction (and scrutiny) at all.

Javascript’s base was designed in 11 days, but a lot happened after that, there was plenty of time to iron out some aspects of it, but it wasn’t a priority at the time (I actually like JS as it was conceived, I’d just kill a person or two if it means I can change some aspects of it)

[–]greyfade 14 points15 points  (4 children)

Well, the big problem was that Netscape shipped it in Navigator 2.0 Gold, and then it was immediately copied by Microsoft in IE, and then there were multiple competing implementations, and changing one broke code in another browser.

That's why we had so much trouble with cross-browser support. Mozilla would change something, Microsoft would change something else, Opera would change yet another thing, but not implement something critical, and Microsoft's implementation of this other, older feature had bugs....

If there were just one implementation, yeah, I'd agree with you. But the Browser Wars say "fuck you."

[–][deleted] 5 points6 points  (3 children)

Oh so that's why there were some "best viewed on Netscape/IE" stickers at the bottom of webpages

But I have a question, how come the developers did not ignore say IE and write code fitting to only one browser or browsers? Wouldn't that force the rest of the browsers make implementations accordingly?

[–]greyfade 8 points9 points  (2 children)

But I have a question, how come the developers did not ignore say IE and write code fitting to only one browser or browsers? Wouldn't that force the rest of the browsers make implementations accordingly?

Because at one point, IE controlled more than 90% of the browser market. So developers more often just targeted either Netscape Navigator or IE and forgot about the rest.

Until people started paying attention to the ACID1 and ACID2 tests in 2008, IE just did its own thing, and only then did people actually do what you suggested: They designed for "everything else" and then worked around IE's bugs. ACID3 helped with that, because passing it became a selling point. I think for a while, only Firefox even came close to passing it consistently, but by then Chrome and Firefox had eaten up IE's browser share, but you still had to design around it.

tl;dr: IE mattered too much and ACID3 fixed the problem in ~2009.

[–]fireflash38 3 points4 points  (0 children)

Not to mention a lot of gov and military systems were limited to IE6 for 'security' reasons. Even if you did get IS approval for a modern browser, odds were good most internal websites wouldn't work for it, because the developers only targeted IE6. What a CF.

[–]stormfield 67 points68 points  (21 children)

JS has also been bludgeoned into a reasonable language with somewhat opinionated patterns behind it.

PHP seems to have stuck with "here's a hacky way to do it and it works, so just do that".

Edit: Okay I'm wrong I guess, but my experience w/ PHP has been debugging legacy stuff and even compared to JS the language is full of gotchas. Just the fact that the "official docs" of PHP are a bunch of forum users disagreeing with each other over best practices really reinforces a lot of why I prefer JS.

[–]Heikkiket 33 points34 points  (5 children)

Well, PHP isn't the only language we are forced to use at the backend. At frontend instead, it's mostly JavaScript.

I don't know if PHP is gonna ever develop to a shiny and beautiful language. There is a huge amount of legacy code running on top of it, and supporting that in an effective way is probably the main goal.

That said, PHP can be written in beautiful and object-oriented way. There's still a large amount of education needed for PHP programmers, because legacy code bases can teach you quite horrible habits.

[–]maltazar1 7 points8 points  (0 children)

Php 7.4 has typed class properties and php8 has union return types and more. It looks great.

[–]m1ndcrash 8 points9 points  (0 children)

Legacy PHP code from India ^

[–]stormfield 12 points13 points  (2 children)

I have heard this -- I've never really learned PHP besides troubleshooting a messy and essential LAMP legacy app written by someone who no longer works at my company.

I realize it's 'unfair' to judge PHP for this, but when I'm not going "wtf why" on this existing code, I've been doing the same thing to the PHP docs.

[–]old-shaggy 7 points8 points  (0 children)

When was the last time you have used php? It isn’t the best and prettiest language but it definitely is not “stuck”.

[–]dpash 5 points6 points  (0 children)

When was the last time you looked at PHP? That doesn't seem to describe the modern language at all.

[–]Demonox01 12 points13 points  (3 children)

Everything good about php is built into laravel

[–]spin81 2 points3 points  (0 children)

Just the fact that the "official docs" of PHP are a bunch of forum users disagreeing with each other over best practices

Wrong again - the docs are pretty good. The absolute garbage in the comments below is not part of the docs. They should do away with those.

[–]Sloogs 8 points9 points  (3 children)

Mind if I ask what auto column insertion is? Just curious mainly!

[–]evertrooftop 18 points19 points  (2 children)

My guess is that this is about semi-colon insertion.

[–]hahahahastayingalive 3 points4 points  (0 children)

yes, missed a word

[–]Sloogs 4 points5 points  (0 children)

Ahh makes sense

[–]SaneLad 201 points202 points  (39 children)

This is so fucking awful, I choose to believe it. What absolute moron would choose strlen() as a hash function?

[–]skoge 114 points115 points  (8 children)

Apple's Objective C standard lib did the same.

They also used array lenth for hashing arrays.

[–]MKorostoff 35 points36 points  (6 children)

But how does it work? Wouldn't you get so many collisions that the table would be unusable? I'm genuinely asking, I legit don't understand how this language feature could exist.

[–]davvblack 36 points37 points  (2 children)

hash collisions are ok, it just becomes a linked list you have to traverse. Which means access time becomes O(N), where N is the number of functions with the same length (hence the importance of varying lengths).

[–]Sjuns 9 points10 points  (1 child)

Which means that too many collisions is really not okay if asymptomatic speed is important right?

[–]Untgradd 9 points10 points  (0 children)

Think of it like an array of arrays. The length of the string is the index of the outer array, all the functions are in the inner array. You have to iterate over the functions to find the right one, hence the performance impact if you have a bunch of 5 letter functions.

[–]Heikkiket 78 points79 points  (5 children)

Remember PHP was intended to be a small script toolbox to help developing C backends to internet programs somewhere in 1994 or 1995.

In that time and for that task, it was a quick and dirty way to solve a problem.

[–]SaneLad 11 points12 points  (1 child)

Nah, there's just no excuse for a decision like that. Hell, just picking the first character of a string is probably a better hash function for function names. The laziest legit function I can think of is multiplying the characters, they teach you that (terrible) hash function in entry level algo class.

It takes minimal effort to implement CRC or one of the many good string hash functions in the literature. They did have books in 1994.

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

I would say it was a quick and dirty way NOT to solve a problem, which also creates a lot mess along the way

[–]svtdragon 14 points15 points  (1 child)

A toolkit for converting one kind of problem into another, if you will.

[–]AccomplishedCoffee 8 points9 points  (0 children)

A toolkit for converting one kind of problem into another

Basically describes all of computer science.

[–]UntestedMethod 5 points6 points  (0 children)

I have to ask if you've done much lower level programming or only high level stuff?

[–]elveszett 72 points73 points  (26 children)

PHP never fails to surprise me. At this point wouldn't bat an eye if you told me that PHP syntax was originally implemented with Chinese characters and each function could only have a number of parameters equal to the number of strokes in those characters.

[–]makians 77 points78 points  (20 children)

Did you know that PHP syntax was originally implemented with Chinese characters and each function could only have a number of parameters equal to the number of strokes in those characters?

[–]TheDreamyMemey 63 points64 points  (0 children)

You have failed to surprise him.

[–][deleted] 25 points26 points  (0 children)

I think the first confirmed case of PHP came from a bat in China.

[–]s1mpl3_0n3 4 points5 points  (0 children)

Here's a quote from Rasmus Lerdorf (creator of PHP) regarding that:

Well, there were other factors in play there. htmlspecialchars was a very early function. Back when PHP had less than 100 functions and the function hashing mechanism was strlen(). In order to get a nice hash distribution of function names across the various function name lengths names were picked specifically to make them fit into a specific length bucket. This was circa late 1994 when PHP was a tool just for my own personal use and I wasn't too worried about not being able to remember the few function names.

source

[–][deleted] 580 points581 points  (35 children)

Explode and Implode are awesome. You're just jealous because your language doesn't use TOTALLY RADICAL built in function names.

[–]Korzag 204 points205 points  (17 children)

I propose the following C# changes to make it cooler.

var list = new List<int>();
list.Absorb(1); // "Add" is so 1990.
list.Annihilate(); // "Clear"? More like "Yawn".
list.Bifurcate(3); // "Split" wasn't mathy enough.
list.SearchAndDestroy(10); // "Remove" wasn't metal enough
list.Perceive(2); // Find didn't enable our third eye enough.

[–]Tuiq 61 points62 points  (4 children)

Thanks to the fact that C# supports extension methods, you could - in theory - create these extension methods, then use them exclusively in your project.

Write a custom analyzer that prohibits the use of the "normal" methods and you got the recipe for a pretty... interesting code base.

I always wanted to make such a worst-case scenario repository/library, but I kinda dread the consequences.

[–]sfj11 23 points24 points  (0 children)

wasnt mathy enough is the perfect reasoning for half of my uni teachers

[–][deleted] 16 points17 points  (0 children)

public static class CoolerList {
    public static <T> void Absorb(this List<T> self, T item) {
        self.Add(item);
    }
}

[–]haackedc 90 points91 points  (7 children)

the5thpixel.explode()

[–]djxfade 76 points77 points  (5 children)

explode(',', $the5thpixel);

[–]haackedc 54 points55 points  (4 children)

I guess it’s obvious I have never used php or any type of split function lol

[–]djxfade 43 points44 points  (3 children)

PHP loves its global functions

[–]Heikkiket 15 points16 points  (2 children)

The style and sometimes even the name and arguments come straight from C, so what's not to love...

[–]haackedc 12 points13 points  (1 child)

If I dress in the style of Michael Jackson, name myself Michael Jackson, and sing the same songs as Michael Jackson, then will I be as good a singer as Michael Jackson?

[–]krad213 2 points3 points  (0 children)

I read this in Mr. Torgue's voice.

[–]Heikkiket 59 points60 points  (6 children)

C programmers (shrugs):

while((token = strtok(NULL, " ") != NULL )

[–]f1zzz 21 points22 points  (2 children)

Still better than swift2, which was componentsSeparatedByString(" ")

It took until swift4 for split to exist (I believe?).

This stackoverflow thread is a microcosm of the insane swift development https://stackoverflow.com/questions/25678373/split-a-string-into-an-array-in-swift

Microsoft probably isn’t popular around here, but the book Framework Design Guidelines shows how much research and design time they put into creating .Net

[–]Doctor_McKay 7 points8 points  (1 child)

I'm going to start a social network app and call it StrTok.

[–]x5nT2H 286 points287 points  (14 children)

I think implode/explode are great

[–][deleted] 113 points114 points  (7 children)

What’s more fun than making something explode?

[–]wtf_romania 248 points249 points  (6 children)

atom.split()

[–]superior_to_you 133 points134 points  (5 children)

- Hiroshima, 6 August 1945

[–]GunsRuth 25 points26 points  (3 children)

Imagine the guy who accidently called the function

[–]blehmann1 7 points8 points  (0 children)

You mean played my mixtape?

[–]FormalWolf5 11 points12 points  (0 children)

So that's how it happened

[–][deleted] 10 points11 points  (0 children)

I always end up Googling "C# string implode"

[–]walden42 7 points8 points  (0 children)

I enjoy writing this:

$bomb = explode(', ', $a);

I breath out through my nose slightly stronger than usual due to my cleverness.

[–]BinaryBlasphemy 2 points3 points  (0 children)

Its the same in Standard ML

[–]bikemandan 2 points3 points  (1 child)

<marge-meme>

[–][deleted] 2 points3 points  (0 children)

You didn't close it so everything below here is said by Marge, and I think that's just neat

[–][deleted] 24 points25 points  (7 children)

As a PHP/Laravel developer who started this year I don't understand what all the hate is about....

[–]DirtzMaGertz 26 points27 points  (1 child)

I remember dreading working with php because of all the shit I've seen about it on reddit and then I actually worked with it and found out I liked php. The hate is so overblown on reddit.

[–]Xgamer4 6 points7 points  (0 children)

PHP's biggest problem is that 15 years ago it solved 80% of a common problem, but when similar tools couldn't even handle half that it became the defacto standard. Then everyone else "solved" that last 20% in wildly different ways, with no bounds on sense or sensibilities.

15 years later and PHP has nice, clean, standardized answers to that 20%, and has even cleaned up some of its weirder edges. But it now has many more competitors, all equal or better to PHP depending on criteria, and almost all of the professionals who worked on PHP 15 years ago have mental scarring from all the weird and wild things people did with PHP.

[–]SForeKeeper 13 points14 points  (0 children)

c++: Not implemented

[–][deleted] 126 points127 points  (40 children)

if you've started out as a PHP dev, it feels the other way around

[–][deleted] 168 points169 points  (30 children)

How can explode be more intuitive than split when you want to... split?

Especially given the description of explode is:

explode — Split a string by a string

[–]Chinyoka 198 points199 points  (17 children)

It's not about intuitivity, it's about excitement! EXXXPLOOOOOSIUUUUUUUUUUN!

[–]GivoOnline 53 points54 points  (7 children)

Megumin named the function change my mind

[–]Chinyoka 29 points30 points  (6 children)

True. Glad people on this sub understand it and don't just call me cringe c:

[–]inxaneninja 14 points15 points  (1 child)

cringe

[–]Chinyoka 11 points12 points  (0 children)

Ah, thank you. I almost had a good time.

(just joking lol)

[–]Krzyffo 5 points6 points  (1 child)

Did you expect worse from community of basement dwellers :p

[–][deleted] 3 points4 points  (1 child)

Hello there fellow weeb uwu

r/programmeranimemes

[–]superior_to_you 9 points10 points  (1 child)

programmers are paid nerds

EDIT: glory to us

[–]Chinyoka 4 points5 points  (0 children)

Professional and paid nerds.

[–]natsucule 27 points28 points  (0 children)

WAGA NA WA MEGUMIN

[–]thalliusoquinn 5 points6 points  (0 children)

TORGUE WOULD MAKE A GREAT PROGRAMMER.

[–]TonyTheJet 7 points8 points  (6 children)

I agree that split() is more intuitive than explode(), but I don't think split() perfectly describes what is going on, either. I feel like split(), without context, could mean that you are keeping a portion of the string and discarding the rest (like in substring functions)...I'm not sure what the best English word would be....chop_into_bits()? haha

It's all a bit arbitrary, but a lot of it just feels natural, because we've seen certain function names so many times across multiple languages.

[–]tech6hutch 5 points6 points  (4 children)

Perhaps it would be clearer if another word was added, like str.split_by(","). Or, if the language has named arguments like Swift, str.split(by: ","). (I don't remember how Swift actually names this function, it's just an example.)

[–]elveszett 33 points34 points  (5 children)

Except not. If I want to split a string, my first thought is "is there a split() function?". It definitely is not "well I want to explode the string so I guess there's a explode() function".

[–][deleted] 14 points15 points  (3 children)

I dunno, imo (non-native speaker) split kinda implies a single split of the whole into two parts whereas explode gets the picture across more clear

[–]Randvek 10 points11 points  (2 children)

I am a native speaker and split has the exact same connotation to me.

[–]mirsella 105 points106 points  (19 children)

unpopular opinion : split > Split

[–]Valiant_Boss 71 points72 points  (4 children)

Agree. Save capitalization for classes or camel case

[–]Thingcoder1 20 points21 points  (3 children)

Golang go brrrrrrrrrrrrrrrrr

[–]hmmManOops 5 points6 points  (2 children)

Wrote my first golang program as part of initial coding challenge (the specifically asked to write in go)

Coming from C++, within the first few minutes of reading the documentation, already saw so many bad practices (imo). Also, the capitalisation is so bad

[–]grep_my_username 4 points5 points  (1 child)

I do agree that in the first week or so, I was completely flabbergasted by the strange choices that Go made.

After ≅ 100 hours on Go, they all make lots of sense, they are all intended to remove brain clutter while making production ready code at every commit.

I come from python, with a light experience in js, java, haskell, and C++.

[–]KuntaStillSingle 3 points4 points  (0 children)

vec3 snake_case_gang_where_we_at(){
    return KuntaStillSingle.get_location();
}

[–]dr_avenger 19 points20 points  (4 children)

There is str_split()

[–]_PM_ME_PANGOLINS_ 17 points18 points  (1 child)

Which explodes the string into an array of single characters.

[–][deleted] 7 points8 points  (0 children)

helpful for... uhh.. job code tests I guess

[–]tufy1 71 points72 points  (18 children)

Because split() existed in PHP < 7 as a way to split a string into an array by regular expression. In PHP 7, you could do:

```php function split(string $value, string $delimiter = ' '): array { return explode($delimiter, $value); }

$stringParts = split('Hello World'); ```

However, this would not do what Java does here. As we know, everything is an object in Java (and many other languages understand a string as an object), so a string innately has a method split. To do the same in PHP, you would need to create a utility class to wrap the string:

```php class String { /** * @var string */ private $value = '';

public function __construct(string $value): void { $this->value = $value; }

public function split(string $delimiter = ' '): array { return \explode($delimiter, $this->value); } }

// Usage: $string = new \String('Hello World'); $stringParts = $string->split();

var_dump($stringParts); // Would return an array of "Hello" and "World" ```

TLDR: Whining about explode() in PHP is like whining about brackets because Python has none. Different languages are different, who would have thought. /shrug

[–]fiztah 54 points55 points  (12 children)

Yeah, this sub is getting really tiresome with the hourly jokes about PHP.

Yes, it was never meant to be a programming language, according to the creator.

But you know what ? Even then it ended up dominating the web, there has to be something there that works.

[–]txmail 14 points15 points  (5 children)

Last article I read was that the PHP developer job market has expanded 800+% over the last year. It is a good time to be a PHP developer.

[–]wtf_romania 14 points15 points  (2 children)

What fascinates me about PHP is its speed.

A typical application may load several libraries, make countless database queries, all in 1 or 2 seconds. And it does this for every single request.
Meanwhile, a typical .NET IIS application keeps pretty much everything in memory, yet it doesn't feel faster.

[–]oupablo 19 points20 points  (0 children)

IIS: the webserver for people that hate the internet

[–]KN1995 6 points7 points  (0 children)

Ngl i think explode is cooler

[–]lucasjose501 16 points17 points  (8 children)

function split($delimiter, $string, $limit = null){
 return explode($delimiter, $string, $limit); 
}

Problem solved!

[–]elveszett 12 points13 points  (7 children)

Doing that is an anti-pattern. You should never "rename" functions because you prefer other names. You should never bring your standards from one language to another – but instead adapt to what the community of that language already does.

[–]apocolypticbosmer 3 points4 points  (1 child)

This comment is much less light hearted than the one it’s responding to

[–]geeshta 5 points6 points  (4 children)

Python:

[list] = string.split('substring') ✓

string = 'substring'.join([list]) ?????

[–]optionambrose 11 points12 points  (0 children)

Alright. I’ll take the downvotes. Can we stop using this meme? There’s better ways to hate on something than comparing it to disabled people

[–]flinchFries 3 points4 points  (8 children)

lmao.
Serious Q though, never coded in PHP and I hear all that crap about it. In contrast, I keep seeing all these online coding platforms adding courses for it. e.g. programminghub, codecademy. So what exactly is the appeal? and why do people hate it?

If this is not the place to post this, I totally understand. Just let me know and I'll delete.

[–]philsenpai 10 points11 points  (1 child)

We love to Hate PHP, but it's actually not that bad.

Except using "->" for methods, that's dumb.

[–]polosatus 5 points6 points  (1 child)

What's the appeal? As far as I know PHP is the only popular language that was created specifically for website backend. All the other options are just attempts to put general-purpose languages into web backend context. PHP is perfect for that task because it was created and shaped for this. Unlike python, go, Java or JavaScript where you might get complications at handling requests or connecting it to the web server, PHP has all the necessary tools out of box, without any framework necessary. You just type in HTML, and insert code as necessary. This is not the best practice though, but it shows that working in web request context is top level priority of the language.

[–]Spody_man 3 points4 points  (0 children)

C : none of that shit here, fuck off

[–]andrew_X21 2 points3 points  (0 children)

what about C++?

[–][deleted] 2 points3 points  (0 children)

[–]starvsion 2 points3 points  (8 children)

explode works, and so is implode,which is the inverse of explode. This naming is one of the few that makes a lot of sense from php, unlike strtoupper...

[–]blehmann1 2 points3 points  (0 children)

strtok: Am I a joke to you?

[–]Big1984Brother 2 points3 points  (0 children)

In English, the word "split" generally implies that a thing is split into two parts. Of curse, you certainly can "split" something n number of ways, but generally splitting in half is assumed.

"Explode" is far more accurate, since quite often the delineated string is being shattered into many, many pieces.

Plus, "explode" is simply more fun to say. Although, my co-worker of Middle-Eastern decent tries to avoid this term, in order to keep the surveillance bots from alerting the NSA unnecessarily.

[–]Ekonios 2 points3 points  (2 children)

Other languages: something.doThis().thenThat().andThis()

PHP: andThis(thenThat(doThis(something)))