3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = ["foo" => "bar", "hello" => ["world", "people of the world"], "a" => 1]; $size = strlen(json_encode($content, JSON_NUMERIC_CHECK)); $JSONDATA= array( 'response' => true, 'error' => null, 'payload' => array( 'content' => $content, 'size' => $size ) ); $joutput = json_encode($JSONDATA,JSON_NUMERIC_CHECK); echo $joutput;
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
{"response":true,"error":null,"payload":{"content":{"foo":"bar","hello":["world","people of the world"],"a":1},"size":59}}

preferences:
137.14 ms | 404 KiB | 261 Q