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).
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.
Also, you can do it in C - sqlite's "amalgamation" is proof of that, but they use a bundler tooling IIRC.
There's also PsySH, 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.