1<?php
2global $jsond_prefix, $jsond_encode, $jsond_decode,
3    $jsond_last_error, $jsond_last_error_msg;
4
5$jsond_prefix = function_exists('jsond_encode') ? 'jsond' : 'json';
6$jsond_encode = $jsond_prefix . '_encode';
7$jsond_decode = $jsond_prefix . '_decode';
8$jsond_last_error = $jsond_prefix . '_last_error';
9$jsond_last_error_msg = $jsond_prefix . '_last_error_msg';
10
11function jsond_constant() {
12    global $jsond_prefix;
13
14    $constant_value = 0;
15    $constants = func_get_args();
16    foreach ($constants as $constant) {
17        $constant_value |= constant(strtoupper($jsond_prefix) . '_' . $constant);
18    }
19
20    return $constant_value;
21}