[PHP] Re: breaking the string

2004-05-14 Thread Torsten Roehr
Gowthaman Ramasamy [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
 hello list,
 can we split a string into substrings of particular size.
 for example ..
 i have as sting of 1000 characters. can i split it into stings of 150
 and feed them into an array.


This should be EXACTLY what you're looking for:
http://de3.php.net/manual/en/function.str-split.php

Regards, Torsten

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



[PHP] Re: breaking a string into chunks

2003-09-19 Thread David Robley
In article [EMAIL PROTECTED], davidtg-
[EMAIL PROTECTED] says...
 Hi, all --
 
 Now it's my turn to ask a simple question, or one that sure sounds like
 it should be...
 
 I have a 14-char date string like 20030917181909 and I need to break it
 into its component parts for a more readable 2003-09-17 18:19:09 view.
 How can I do that?  Do I really need to call substr half a dozen times?(!?)
 
 I tried unpack() but all I ended up getting was an array with one entry
 (sometimes with a very strange-looking key).
 
 
 TIA  HAND
 
 :-D

If you are getting that string from a database, and the database is mysql, 
you could let the db do the work. See DATEFORMAT() in mysql.

Cheers
-- 
Quod subigo farinam

A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet?

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