<?php
$data = /** whatever you're serializing **/;
header('Content-Type: application/json; charset=utf-8');
echo json_encode($data);
Other recipes
In case you haven't read them yet
How to create and run a Docker container from an image
10 October 2022 at 12:35 AM
How to create and run a Docker container from an image
Output text using PHP
01 November 2022 at 10:11 PM
How to display text using PHP
PHP PSR-1 Standard: Basic Development Standard
02 November 2022 at 08:36 PM
This section of the standard includes what should be considered standard code development elements that are necessary to ensure a high level of technical compatibility between common PHP code.
PSR-2 Standard: Code Formatting Guide
03 November 2022 at 05:10 PM
This guide complements and expands on PSR-1, the core development standard. General set of rules and expectations regarding how to format PHP code