a pastebin project

Miscellany

  1. //if you happen to have php 5.2.0 or higher you can use the standard json_encode() / json_decode() functions that are //way faster (coded in c, like 100 - 200 times faster)
  2. //if you want to keep it portable in case, then try something like this:
  3.  
  4. if (!function_exists('json_encode')){
  5. //now its portable to php ver. < 5.2.0 where you would otherwise have to install the php-json c-extension first
  6.     include('JSON.php');
  7.     $json = new Services_JSON();
  8.     function json_encode($value){
  9.         global $json;
  10.         return $json->encode($value);
  11.     }
  12.     function json_decode($value){
  13.         global $json;
  14.         return $json->decode($value);
  15.     }
  16. }
  17.  
  18. // then just use the standard functions json_encode() / json_decode()

advertising

Create a Paste

Please enter your new post below (or upload a file instead):





Please note that information posted here will not expire by default. If you want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords.

worth-right
worth-right
fantasy-obligation
fantasy-obligation