Re: [PHP] [SOLVED] class to generate Javascript Object ??

2009-10-04 Thread Michael A. Peters

Andrea Giammarchi wrote:




Thank you, worked beautifully.


just don't ignore this:
PHP 5 >= 5.2.0

if you are trying to create something portable, you should consider a Pear 
fallback ...


I make heavy use of DOMDocument so I need 5.2.x anyway.
But thanks for the warning.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP] [SOLVED] class to generate Javascript Object ??

2009-10-04 Thread Andrea Giammarchi



> Thank you, worked beautifully.

just don't ignore this:
PHP 5 >= 5.2.0

if you are trying to create something portable, you should consider a Pear 
fallback ...

if(!function_exists('json_encode')){
require_once 'JSON.phps';
// http://mike.teczno.com/JSON/JSON.phps
function json_encode($o){
$json = new Services_JSON;
return $json->encode($o);
}
}

Regards
  
_
Windows Live Hotmail: Your friends can get your Facebook updates, right from 
HotmailĀ®.
http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_4:092009

Re: [PHP] [SOLVED] class to generate Javascript Object ??

2009-10-04 Thread Michael A. Peters

Andrea Giammarchi wrote:


 > I'm thinking (hoping) there is already a php class somewhere for
 > generating JavaScript object strings that I can instead of my ugly
 > easily breakable way of doing it.
 >
 > Anyone know of one?


json_encode
http://uk3.php.net/manual/en/function.json-encode.php



Thank you, worked beautifully.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php