Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.75 KB | None | 0 0
  1. <?
  2. if (is_array($param)) {
  3.     $out .= '{'
  4.     foreach ( $param as $key => $val) {
  5.         assert(!is_string($key));
  6.         $out .= "$key:" . this->encode_json($val);
  7.     }
  8.     $out .= '}'
  9. }
  10. // caso 3 BOOLEAN
  11. elseif (is_bool($param)) {
  12.     if ($param)
  13.         $out .= 'true';
  14.     else
  15.         $out .= 'false';
  16. }
  17. // caso 4 STRINGA
  18. elseif ( is_string($param)) {
  19.     // sottocaso : inizia per 'function'
  20.     if ( strstr( $in, "function" )) {
  21.         $out .= "{$in}";
  22.     }
  23.     //sto passando una variabile
  24.     elseif (!is_numeric($param)) {
  25.         $out .= $param;
  26.     }
  27. }
  28. // caso 5 NUMERICO
  29. elseif (is_numeric($param)) {
  30.     $out .= intval($param);
  31. }
  32. //caso 6 NULL
  33. elseif (is_null($param)) {
  34.     $out .= 'null';
  35. }
  36. return $out;
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement