How to Write Json in PHP

In PHP JSON stringify and parse are part of the core libraries - however in PHP they are called json_encode and json_decode respectively. The latter was shown in the post about parsing json in PHP.

<?php
$arr = array("name" => "Claus Witt", "ideas" => array("one idea", "another idea"));
$json = json_encode($arr);
echo $json;