RE: newbie: string to char array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm



> -----Original Message-----
> From: Horst Jäger [mailto:h.jaeger@xxxxxxxxxxxxxxxxx] 
> Sent: 10 November 2004 09:51
> 
> I wonder if it is possible to convert a given string into an 
> array of chars 
> without using a separator.
> 
> That is, is there a function
> 
> mySplit
> 
> with
> 
> mySplit('example') == array('e', 'x', 'a', 'm', 'p' 'l' 'e') ?

Do you absolutely need it as an array?  If indexing by character would
suffice, just use PHP's {} syntax:

  $s = 'example';
  echo $s{0};    // e
  echo $s{1};    // x
  // etc.

Cheers!

Mike

---------------------------------------------------------------------
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning & Information Services, JG125, James
Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS,
LS6 3QS,  United Kingdom
Email: m.ford@xxxxxxxxxxxxxx
Tel: +44 113 283 2600 extn 4730      Fax:  +44 113 283 3211

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux