<commit_before><commit_msg>Example json code from Chapter 6 in Barr.<commit_after>#!/usr/bin/php
<?php
// example json code from Barr, Chapter 6

$values = array(1, "one",
  array(1, 2, 3),
  array(1, 2, array('a' => 'Uno', 'b' => 'Dos'))
);

print("Array encodes to this:\n");
print("\t" . json_encode($values) . "\n");

$encoded = json_encode($values);
$decoded = json_decode($encoded, true);

print("Encoded array decodes to this:\n");
print("\t" . '$decoded[1]: ');
print($decoded[1] . "\n");
print("\t" . '$decoded[3][2][\'a\']: ');
print($decoded[3][2]['a'] . "\n");

?>

{'fraction_non_alphanumeric': 0.2651646447140381, 'fraction_numerical': 0.024263431542461005, 'mean_word_length': 4.7227722772277225, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4519172', 'n_tokens_mistral': 231, 'n_tokens_neox': 222, 'n_words': 53}