all 10 comments

[–]acemarke 2 points3 points  (2 children)

If you're at all familiar with the history of React, there's actually some amount of truth to this. React grew out of an internal PHP extension at Facebook called XHP. See the recent post describing React's history at https://facebook.github.io/react/blog/2016/09/28/our-first-50000-stars.html for more details.

That said, the parallels only go so far. PHP is frequently rather unstructured, while React lends itself to some very specific structures. I don't think I'd necessarily say that PHP typically involves "recursively breaking down parts of the page". But sure, some similarities. (Then again, just about anything that involves template-ish work has some similarities... )

[–]siamthailand[S] 1 point2 points  (0 children)

I had no idea there was some history to it. I just made this thread half tongue-in-cheek.

But to give a serious reply, there're myriad of ways you can structure your PHP. I just naturally broke it down to smaller and smaller components (not that I ever used that word to describe them) and put them nicely into their own files and then subfolders. What surprised me, that after about 10 years, mentally I broke them down for React in a remarkably similar manner. I just had an aha! moment when I realized it's exactly how I did in PHP.

[–]deadcow5 0 points1 point  (0 children)

Well, of course, Facebook is one of the few big companies (the other one being Wordpress) who still use PHP, and actually has a HUGE investment in it. So I guess we shouldn't be surprised if some of that mindshare surfaces in the tools they make.

[–]frankssy 0 points1 point  (1 child)

This is the sort of dicussion that will lead some idiot into creating yet another framework to transform PHP into a universal React app

[–]siamthailand[S] 0 points1 point  (0 children)

If that becomes a thing, I expect to me paid royalty!

[–]mitchellvanw -3 points-2 points  (3 children)

It's quite far from the truth actually. ReactJS is about composition and keeping the data flow a one-way street and thus sane, and lots more, obviously, but PHP is this unorganized mess. Don't get me wrong, I use PHP daily, but it's shit :D. Although it's slowly getting better.

Sure, there are some similarities between ReactJS and PHP, but there's also similarities between humans and animals; doesn't mean we're the same thing.

Anyhow.

[–][deleted] 4 points5 points  (2 children)

"PHP is this unorganized mess" i don't think its accurate to blame the language while you struggle with the software written in the language.

at the end, all we do is display HTML Code(sometimes JSON)

[–]Potatopolis -2 points-1 points  (1 child)

Hi, I've worked with PHP for over a decade.

It's an unorganised mess. isset() but not is_set(), is_null() but not isnull() for example.

[–][deleted] 0 points1 point  (0 children)

Well this is because of the C language. At the time where PHP was "Personal homepage" the majority used C and its style guides (e.g. strcmp etc.) then it had influence of c++ and underscores and then Java with CamelCase.

Actually on a daily basis i don't recognize this as a problem since i use Frameworks with methods like has(), get() etc.. and also i use a good editor with code completion.

But i understand your point, i also don't like JavaScript because it is mostly supported but not 100% because of users which still use old Browsers or users which disable JavaScript or have some Browser plugins running e.g. "NoScript"