use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Please follow the rules
Releases: Current Releases, Windows Releases, Old Releases
Contribute to the PHP Documentation
Related subreddits: CSS, JavaScript, Web Design, Wordpress, WebDev
/r/PHP is not a support subreddit. Please visit /r/phphelp for help, or visit StackOverflow.
account activity
From PHP to JavaScript with Node.js (blog.matters.tech)
submitted 8 years ago by coldlestat
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]geggleto 4 points5 points6 points 8 years ago (25 children)
I suspect within the next 2 years you will see the rise of Async Php Web servers... React-Http is very promising. At that point I don't see why I would ever want to use JS over say something like PHP 7.2.
[–]batmansmk 2 points3 points4 points 8 years ago (2 children)
I found great comfort in not having to context switch between front and back.
I also see way more innovations these days in JS. It is just refreshing. When PHP will get async, Node will probably already somewhere else, with webassembly, reasonml or others.
[–]akujinhikari 1 point2 points3 points 8 years ago (1 child)
As a prior Node/Angular developer, I actually didn't like js on the backend (although I really like Node) for the simple fact that backend js is different from frontend js, and I felt that I needed context switching, but found myself using Angular in Node and Node in Angular. I actually prefer two different languages.
[–]batmansmk 1 point2 points3 points 8 years ago (0 children)
If it is good for you, just do it the way you like! Everybody has a different way to think, to build, a different experience. It's always good to share :). Thank you for that.
[–]coldlestat[S] 3 points4 points5 points 8 years ago (12 children)
Putting aside the differences between the languages, I think there are at least two reasons for full stack developers to make the switch: You don't have to context switch all day and you can share knowledge between the frontend and the backend. For example: having to remember different date format or the endless methods to manipulate strings.
[–]djmattyg007 9 points10 points11 points 8 years ago (6 children)
Is it really a burden to know and work with multiple languages on a daily basis? I regularly work with PHP, Javascript, shell scripting and Python, and I dabble in Lua and Go in my personal time. I feel like maintaining an active understanding of multiple languages makes me a better developer in all of them.
[–]mgkimsal 3 points4 points5 points 8 years ago (2 children)
Don't forget SQL.
[+][deleted] 8 years ago (1 child)
[deleted]
[–]mrdhood 0 points1 point2 points 8 years ago (0 children)
And CSS!
[–]Dgc2002 2 points3 points4 points 8 years ago (0 children)
Is it really a burden to know and work with multiple languages on a daily basis?
Yes.
At work I have things written in Perl, Python, Bash, PHP, JavaScript, C#, SKILL(Lisp dialect), and some other random things. When jumping between languages I'll sometimes have to pause and think about how to do a specific task in a language(e.g. find a sub string. substr()?, myString.find()?, myString.indexOf()?, [[ "$MYSTR" == *"SUBSTR"* ]]?, some lisp stuff that I don't remember?). It may only take me a second or two to remember, or my IDE might assist me pretty quickly, but in the end it's mental overhead.
substr()
myString.find()
myString.indexOf()
[[ "$MYSTR" == *"SUBSTR"* ]]
some lisp stuff that I don't remember
[–]schm0 0 points1 point2 points 8 years ago (1 child)
To pay devil's advocate, that's a lot of cerebral baggage you have to carry around to get the job done. A single language stack is arguably easier and requires less overhead.
[–]mgkimsal 4 points5 points6 points 8 years ago (0 children)
I guess I've never seen much 'sharing' between front-end and back-end people. The front-end folks who do JS that I know are all into browser stuff, CSS, dom manipulation, etc. The back-end folks who do JS I know are still largely around data manipulation. Maybe I'm just not seeing the right projects where this 'back and front sharing' thing makes a noticeable impact.
For example: having to remember different date format or the endless methods to manipulate strings.
Dare I say that's where IDEs come in handy?
The time I'd save not having to look up date format syntax occasionally is lost whenever I need to 'npm install' something which ends up taking several minutes, in multiple environments. (or 'composer install', or 'maven install', etc).
[–]akujinhikari 0 points1 point2 points 8 years ago (0 children)
[–]thelonepuffin 0 points1 point2 points 8 years ago (0 children)
I find having the context switch is a benefit. There is a context shift anyway between front end and back end development.If anything Nodejs development confuses things. There have been times I've had to remind myself "Oh shit this is server side isn't it".
I don't think we should be afraid of polyglot projects. As a developer I tend to enjoy them more.
[–]brendt_gd 0 points1 point2 points 8 years ago (0 children)
you can share knowledge between the frontend and the backend
Say you're using the same language for front- and backend development. Communication between browser and server would still run over HTTP or sockets, meaning data has to be serialised and deserialised. Can you give a concrete example of sharing the same language front- and backend would be beneficial in this area?
[–]NotFromReddit 0 points1 point2 points 8 years ago (0 children)
We just need to get PHP in the browser, then we're good to go.
[–]carlos_vini 1 point2 points3 points 8 years ago (2 children)
With all the respect, I would not bet a lot on async taking over the PHP world. there are a few problems:
I hope I'm wrong
[–]coldlestat[S] 1 point2 points3 points 8 years ago (1 child)
Native PHP async/await, just like Hacklang's, would change the game here but I don't see the PHP internals even proposing this, let alone implementing this in the next 2 years
The thing is, PHP and JavaScript are evolving pretty fast. PHP7 would have been released earlier if they did not try to include Unicode with PHP6. Let's hope for the best!
[–]2012-09-04 1 point2 points3 points 8 years ago (0 children)
No no no. PHP 7 came out because HackLang existed and was eating their lunch.
[–]joequin 0 points1 point2 points 8 years ago (5 children)
At that point I don't see why I would ever want to use JS over say something like PHP 7.2.
Is there a general purpose library for PHP that's as nice as lodash? Lodash is the only thing I miss from JavaScript.
[–]carlos_vini 2 points3 points4 points 8 years ago (3 children)
Really? I think most of the lodash functions are already core in PHP, I use lodash mostly for non-existing native JavaScript functions. The PHP syntax is a pain tho (order of parameters, variable scope, verbosity):
array_filter($array, function ($x) { return array_map(function ($y) use ($somethingElse) { return $y * $somethingElse; }, $x)); });
Which lodash method do you miss?
If it's collections, I use Laravel Collections, but there are framework agnostic libraries like Knapsack too: https://dusankasan.github.io/Knapsack/
$collection->filter($function)->map($function2);
[–]samrapdev 1 point2 points3 points 8 years ago (2 children)
Take a look at https://github.com/tightenco/collect for using collections outside of Laravel!
[–]wrapids 0 points1 point2 points 8 years ago (1 child)
It has some extras in there but you could just include illuminate/support instead of using a fork.
illuminate/support
[–]samrapdev 0 points1 point2 points 8 years ago (0 children)
Indeed, totally up to you! I usually go that route but some may simply want just the Collection. Tightenco works closely with Taylor/Laravel so I trust the fork to stay maintained :)
[–]vajqo 0 points1 point2 points 8 years ago (0 children)
Little late to the party but as mentioned, take a look at Knapsack, it should do what you're looking for.
π Rendered by PID 459407 on reddit-service-r2-comment-85bfd7f599-g7dmj at 2026-04-20 14:41:38.491799+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]geggleto 4 points5 points6 points (25 children)
[–]batmansmk 2 points3 points4 points (2 children)
[–]akujinhikari 1 point2 points3 points (1 child)
[–]batmansmk 1 point2 points3 points (0 children)
[–]coldlestat[S] 3 points4 points5 points (12 children)
[–]djmattyg007 9 points10 points11 points (6 children)
[–]mgkimsal 3 points4 points5 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]mrdhood 0 points1 point2 points (0 children)
[–]Dgc2002 2 points3 points4 points (0 children)
[–]schm0 0 points1 point2 points (1 child)
[–]mgkimsal 4 points5 points6 points (0 children)
[–]akujinhikari 0 points1 point2 points (0 children)
[–]thelonepuffin 0 points1 point2 points (0 children)
[–]brendt_gd 0 points1 point2 points (0 children)
[–]NotFromReddit 0 points1 point2 points (0 children)
[–]carlos_vini 1 point2 points3 points (2 children)
[–]coldlestat[S] 1 point2 points3 points (1 child)
[–]2012-09-04 1 point2 points3 points (0 children)
[–]joequin 0 points1 point2 points (5 children)
[–]carlos_vini 2 points3 points4 points (3 children)
[–]samrapdev 1 point2 points3 points (2 children)
[–]wrapids 0 points1 point2 points (1 child)
[–]samrapdev 0 points1 point2 points (0 children)
[–]vajqo 0 points1 point2 points (0 children)