Wouter van Vliet wrote:
 
> On vrijdag 5 december 2003 12:23 Burhan Khalid told the butterflies:
> > Adam i Agnieszka Gasiorowski FNORD wrote:
> >
> > >     How would you specify a regex to
> > >  convert string into array using preg_split?
> > >  Is there some symbol specyfying a place  between letters ?
> > >
> > >     s t r i n g => array('s', 't', 'r', 'i', 'n', 'g')
> > >          ^ ^ ^ ^ ^
> >
> > You can access a string's characters with an index without declaring
> > it as an array.
> >
> > $string = "foo";
> > echo $string{0}; //outputs f
> >
> > http://www.php.net/substr (has an example)
> >
> > Maybe this will solve your problem without using preg_split?
> >
> > --
> > Burhan Khalid
> > phplist[at]meidomus[dot]com
> > http://www.meidomus.com
> > -----------------------
> > "Documentation is like sex: when it is good,
> >   it is very, very good; and when it is bad,
> >   it is better than nothing."
> 
> You kinda need to realize that
> 
>         $String = 'FooBar';
>         print $String[4];
> 
> also prints out an 'B'. But this is adviced AGAINST because it is the same
> syntax as you do for array elements.
> 
> To get a real array, do something like this:
> 
>         $Array = Array();
>         for($i=0;$i<strlen($String);$i++) $Array[] = $String{$i};
> 
> But if you have a string with char-space-char stuff, split(' ', $String);
> would do too.

        No, no spaces between letters (otherways
 it would be very easy, indeed). So there is
 no way to match the "space between alphanumeric
 chars" and split on it? I was trying to avoid
 the loop solution.

-- 
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info  { iWanToDie }   WiNoNa    )   (
http://szatanowskie-ladacznice.0-700.pl  foReVeR(  *  )
Poznaj jej zwiewne kształty... http://www.opera.com 007

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

Reply via email to