Read closely ! There are extra apostrophes inside the quotes !!
Phil

"Lallous" <[EMAIL PROTECTED]> schrieb im Newsbeitrag
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> John, what you said would simply produce:
>    var x = ['str1,str2,str3']
> and not as I want:
>   var x = ['str1','str2','str3']
>
>
> Elias,
>
> "John W. Holmes" <[EMAIL PROTECTED]> wrote in message
> 002101c26de2$982bf7d0$7c02a8c0@coconut">news:002101c26de2$982bf7d0$7c02a8c0@coconut...
> >
> >
> > > -----Original Message-----
> > > From: lallous [mailto:[EMAIL PROTECTED]]
> > > Sent: Monday, October 07, 2002 6:09 AM
> > > To: [EMAIL PROTECTED]
> > > Subject: [PHP] join() , can do that fast?
> > >
> > > 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));
> >
> > 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',...
> >
> > ---John Holmes...
> >
> >
>
>



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

Reply via email to