3 ms·
This "in a single file" property is probably the most unique, and maybe the most enviable feature of PHP. I don't think you can do it in any other language, exc
by theanonymousone 2y ago
This "in a single file" property is probably the most unique, and maybe the most enviable feature of PHP. I don't think you can do it in any other language, except maybe by jumping through hoops (e.g. jbang and uv come close).
- foul 2y agoYou can bundle everything in a file in most programming languages. You may find it useful (for sysadmin purposes) only with scripting languages, because with compiled ones you generally "bundle" most of the software in the executable file.
- hiAndrewQuinn 2y agoGo lets you embed arbitrary files into the binary it creates. If you do that and also compile it to be standalone you have a one-.exe solution.
- theanonymousone 2y agoI meant a single source file. Obviously any compiled language delivers one binary file or so.
- mschuster91 2y agoYou can definitely do it in Javascript but without a bundler it becomes quite the pain. Also, you can do it in C - sqlite's "amalgamation" is proof of that, but they use a bundler tooling IIRC.
- deleted 2y ago[deleted]
- cess11 2y agoI do similar things with Elixir scripts, though commonly I still turn to PHP because there is some single file library that does what I want with a lot less ceremony than the Java variety would require. There's also PsySH, https://psysh.org/ https://psysh.org/, for being something other than a Common Lisp or BEAM interface it's a very nice REPL. Besides Picolisp and iex it's the interactive programming environment I use the most.
- ForTheKidz 2y agoI think a far more enviable thing is that by default the file IS the response body. You can punt on explaining basically the entire web stack until later. You can teach interactive server AND client-side programming without having to explain more about HTTP than GET, POST, path, and the bodies. Curiously, all the things I used to love about the language I now consider major liabilities and footguns. Outside of wordpress I'd have a hard time recommending it—it's so different from other webserver setups you're likely to prolong your frustration. Not to mention it's an ugly language with an incredibly inconsistent runtime library.
- indigodaddy 2y agoAnyone remember the snews single file CMS? It was pretty great..