3 ms·
Nice overview. I like how it seems like PHP has a lot bigger built-in standard library compared to Node, as some people install NPM packages for little simple
by Keverw 7y ago
Nice overview.
I like how it seems like PHP has a lot bigger built-in standard library compared to Node, as some people install NPM packages for little simple things. Then PHP has a built-in time and date helpers, like timezones.
However, the $ dollar sign for variables kinda annoys me, as switching back and forth between PHP and other languages like JS. Like recently ran into an issue where I forget $ in front of a var and JSON encoding it, and then went to var_dump it but realized I forgot the $ so it was outputting the variable name instead of the variable contents. I guess muscle memory.
I know I was reading a blog post though where someone built a React frontend around Wordpress as a headless CMS, thought that was interesting but haven't looked into how to do it yet 100% but was proposing it to someone I know that has a large site built around WP but seems like a mess of plugins and theme tweaks so I felt moved to something else would let controlling the design and changing things without forking plugins when there are tweaks wanted that isn't part of the official plugin, etc as I feel like that would allow more complete control of the presentation layer without tweaking multiple things and stuff. However some businesses don't really care about the tech under the hood, they just want it done quick with results, don't really understand all the technical stuff and care about costs, so not like a tech startup where you care about a lot of the little details or maintaining things for the future. Then some people don't even really know what they want either, but I guess business people managing tech people, but even big tech companies I doubt all of their CEOs are even technical either though but maybe they hire technical project managers to help bridge the gap between the two parts of the business but their product is mostly tech though anyways so I assume a different culture than tech in a non tech business.
Looks like some projects to do server-side react with PHP too, but haven't played with any personally - but that's useful if someone cares a lot about SEO even though Google can crawl SPA's but other search engines might not be as capable, then sharing on social media not sure if they use server-side rendering when grabbing the metadata for open graph for example. That'd be neat to pitch to non tech businesses who might just be running on a cPanel server and don't want to really invest in servers and managing them much yet, so mix both PHP and React would be prefect maybe for some types of companies, PHP and MySQL for the data part with a nice clean modern and fast react front end with near instant page loads.
Kinda interesting about support for web sockets and more async stuff in the future, I guess in theory than you could write real-time game servers in PHP for example? I know some game servers are in C, C#, C++ or Node though, but long-running PHP code would be useful for other types of applications that aren't just mainly restful web pages or APIs.
Then another thing is you might find examples or libs in PHP but have to dig for equivalents in other languages, probably since PHP is so popular and easier to get into maybe. Then somethings you'd find a good lib in Python like I was looking at something and didn't see an official JS client but they offered a C, Go and Python one... Would be neat if somehow you could easily just combine the languages, I seen there is a Node PY bridge though and sounds like some experiments of compiling PHP to WASM but haven't played with it(wondering if it compiles only the code you wrote(I guess perfect for code you happen to strongly type) or the entire PHP binary along with it, but I know FB was working on compiling PHP to C with the HACK project, so a similar idea might work for WASM but not sure if it's a sane idea - maybe just porting the code you need would be a better answer maybe... but that'd be an interesting way to develop, but I guess with microservices you could mix and match too but some little tiny things seems a waste with all the networking calls.