3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pid = "12"; // string number from the database echo json_encode($pid, JSON_NUMERIC_CHECK);

preferences:
31.85 ms | 402 KiB | 5 Q