RE: [PHP] String Question

From: Date: Thu, 01 Aug 2002 07:53:16 +0000
Subject: RE: [PHP] String Question
Groups: php.general 
Request: Send a blank email to php-general+get-110637@lists.php.net to get a copy of this message
or ... while($new = substr($old, $i++ * $strlen, $strlen)) $array[] = $new; Tim Ward www.chessish.com > -----Original Message----- > From: Richard Baskett [mailto:php@baskettcase.com] > Sent: 31 July 2002 20:47 > To: Randy Johnson; PHP General > Subject: Re: [PHP] String Question > > > <? > $string = 'abcdefghijklmnopqrstuvwxyz'; > $strNum = ceil(strlen($string)/8); > > for ($i=0; $i<$strNum; $i++) $newString[] = substr($string, > ($i*8), 8); > > for ($j=0; $j<count($newString); $j++) echo "string$j = > $newString[$j]<br > />"; > ?> > > Rick > > A sense of humor can help you over look the unattractive, tolerate the > unpleasant, cope with the unexpected, and smile through the > unbearable. - > Moshe Waldoks > > > From: "Randy Johnson" <icgphp@icecoldgold.com> > > Date: Wed, 31 Jul 2002 15:26:15 -0400 > > To: <php-general@lists.php.net> > > Subject: [PHP] String Question > > > > Hello, > > > > I would like to be able to do the following but have not > figured out a way to > > handle it > > > > $string="abcdefghijklmnopqrstuvwxz"; > > > > I would like to divde the above string into separate > strings 8 charactes long > > , example > > > > $string1=abcdefgh > > $string2=ijklmnop > > $string3=qrstuvwx > > $string4=yz > > > > if the string were only 10 long > > > > $string=abcdefghij > > > > then > > > > $string1=abcdefgh > > $string2=ij > > > > any suggestions would be greatly appreciated. > > > > Thanks, > > > > > > Randy > > > >

« previous php.general (#110637) next »