How? You'd need to compile it down to machine code somehow, for the processor to have any clue how to run it. And you'd need some custom library with custom compile instructions, to be able to control memory allocations, memory addresses etc..
I did a quick search and found two operating systems written in JS, both of which cop out when it comes to the kernel. Did you maybe mix it up with those?
I mean, I'm a bit out of my water there, both in terms of the featureset of PHP and what's actually needed for a kernel, but I'm still gonna go with no.
For one, PHP uses reference counting + garbage collection for memory management. That's normally done by the language runtime, which you won't have when running baremetal.
Maybe you could implement a kernel, which does as few allocations as possible (generally a good idea for a kernel, but no idea, if it's possible with PHP), and then basically just let it memory leak until everything crashes.
Then again, the kernel is responsible for making processes crash when they have a memory leak. Presumably, our PHP kernel would just start overwriting data from running processes and eventually overwrite itself in memory(?). Either way, it would be horrendous.
Maybe you could also try to implement some basic reference counting into your own PHP code, so that your own code keeps track of how often you've used an object in your own code. Certainly doesn't sound like fun, though.
Well, and secondly, I imagine, you'd also still need an extension of the language, to be able to address actual memory locations and do various operations with them.
I know from Rust, that they've got specific functions in the stdlib for that, see for example: https://doc.rust-lang.org/stable/std/ptr/index.html#functions
Presumably, PHP does not have such functions, because its users aren't normally concerned with that.
Update: thank you for pointing out to me which community this was posted on.
I'm going to leave this post up as a cautionary tale for people like me who don't pay enough attention!
But Linux is cool cuz it's so fast and it doesn't break.
Long as I've been using it anyway.
So now linux is going to be much slower, going to break and be more susceptible to security breaches?
I'm not a programmer, is the upside supposed to be that with so many more programmers able to work on the kernel, those issues will be able to be fixed by the extra programmers?
It's not like there's anything wrong with Linux right now.
PHP and C are both fine languages, they have their strengths and their weaknesses. They're tools and if you feel the need to shit on them then you clearly need more practice using a diversity of languages.
PHP is probably a fine language, my issue is I suffered dealing with so many shitty applications written in php when I was still coming up through the ranks of IT.
God the number of broken WordPress installs and shitty WordPress plugins.
Ah yes, the almighty counter "everything is relative". "Malbolge is a fine language with its strengths and weaknesses. It has perfectly valid usecases and can never be shit on, ever."
I'm learning Ruby on Rails. Would you recommend it as a good website framework? Or something else? I've already tried Laravel, CakePHP, Vue/Vite, and making my own from scratch .
I do! I am self-taught but now have a great career going in it. My only complaint is that once you start requiring very specific gems, you’ll find a bunch of unmaintained stuff. Ruby was hyped up a lot in the beginning, kind of declined during the Node.js fad but is becoming a lot more stable and continues to show a ton of progress.
These days if you want to get your foot in the door you can find work upgrading Rails versions as a lot of companies seemed to have released apps a long time ago then lost track of time.
Realizing most of this sounds pretty negative but it’s a beautiful language that I love working in every day. The language is so flexible/usable that outsiders complain that it can encourage bad habits simply by being so maleable — my recommendation is to really know the difference between plain Ruby and Ruby on Rails.