How to screenshot PHP code properly: what PHP snippets actually look like, how auto-detection behaves, the theme that reads best, and the settings that keep the card legible.
Two eras of PHP end up on the same page: a controller action with typed properties and constructor promotion (public function __construct(private OrderRepo $repo)), and older procedural code with $rows = mysqli_query(...) and while ($row = …). Both share the signature feature that defines the language visually: every variable starts with $, and that sigil is the fastest way a reader recognises PHP at a glance. Also common: <?php on line one, -> method chains, :: static calls, and heredoc/nowdoc strings.
PHP is rule 9, and it sits six positions before the JavaScript rule. Its trigger is <?php or function name( — the second half is why a plain JavaScript snippet opening function debounce(fn, ms) { is rendered as PHP: the PHP rule fires first and wins outright. This is the single most common wrong-language render on the whole site. $var is not a trigger, so a PHP fragment without <?php and without a function declaration can fall through to the TypeScript default. <?php at line one is therefore the reliable signal in both directions.
dracula for dark: its variable colour is distinct from its string colour, and PHP cards are mostly variables and strings, so the two need to separate cleanly. min-light for light — the $ sigil already adds visual noise, so the theme should add none.
<?php tag. It costs one line and it fixes detection for every PHP snippet that does not declare a function.function, set language: "javascript" manually — otherwise you get PHP colouring and, worse, a confident-looking wrong result.?>; it is optional in modern PHP, and it saves a line of pure punctuation at the bottom of the card.Feature by feature, against the other code screenshot tools.