Hello,

I have:
$x = array('str1','str2','str3');

I want to convert that array to a valid javascript syntax as:

var x = ['str1','str2','str3']

I can do this in PHP:

echo sprintf("x=[%s]", join(',', $x));

but that would produce:
x = [str1, str2, str3]

is there is a fast way (other than doing a loop) to have join put quote
around each array value before joining? so final result looks like:
['str1','str2',...


Thanks,
Elias



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

Reply via email to