Shadow-Here


Server : Apache
System : Linux methusalix2 3.16.0-11-amd64 #1 SMP Debian 3.16.84-1 (2020-06-09) x86_64
User : hios ( 1437)
PHP Version : 5.6.40-0+deb8u12
Disable Function : proc_close,proc_open,dl,shell_exec,passthru
Directory :  /home/repuls/httpdocs/swm2/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :
Current File : /home/repuls/httpdocs/swm2/jsonencode.inc.php
<?php

// PHP 5 >= 5.2.0, PECL json >= 1.2.0 -> http://php.net/manual/de/function.json-encode.php

if(!defined("JSON_NUMERIC_CHECK"))
  define("JSON_NUMERIC_CHECK", 32);

if(!function_exists("json_encode")) {

 function json_encode($val, $options = 0){
   internal_json_encode($val, $options);
 }

}


function internal_json_encode($val, $options = 0)
{
    if (is_numeric($val))
      if($options == JSON_NUMERIC_CHECK)
         return $val;
         else
         return '"'.$val.'"';

    if (is_string($val)) return '"'.addslashes($val).'"';

    if ($val === null) return 'null';
    if ($val === true) return 'true';
    if ($val === false) return 'false';

    $assoc = false;
    $i = 0;
    foreach ($val as $k=>$v){
        if ($k !== $i++){
            $assoc = true;
            break;
        }
    }
    $res = array();
    foreach ($val as $k=>$v){
        $v = internal_json_encode($v, $options);
        if ($assoc){
            $k = '"'.addslashes($k).'"';
            $v = $k.':'.$v;
        }
        $res[] = $v;
    }
    $res = implode(',', $res);
    return ($assoc)? '{'.$res.'}' : '['.$res.']';
}


?>

Samx