Reply to Re: Splitting a string into three parts

Your name:

Reply:


Posted by Krustov on 09/20/07 00:56

<comp.lang.php>
<>
<Wed, 19 Sep 2007 21:48:01 -0000>
<1190238481.305757.111070@k79g2000hse.googlegroups.com>

> > > $string1 contains words 0-200 from $articleBody
> > > $string2 contains words 201-400 from $articleBody
> > > $string3 contains words 401-600 from $articleBody
> >
> > $newtext=wordwrap($slap,200,"\n",1);
> >
> > --
> > (c) The Amazing Krustov
>
> I'm sorry, but that does not do what I described. I need to take one
> string and turn it into three separate strings. Thank you for your
> quick reply, though.
>

A bit luddite - but it seems to work ok .



<html>
<head>
<title>Test</title>
</head>

<body>

<?php

$articleBody="
Search: the web pages from the UK
New! View and manage your web history
Web Results 1 - 10 of about 82,200,000 English pages for large text
file. (0.10 seconds)
Large Text File Viewer 4.1 - Features
Have you ever felt frustrated when you justor Notepad or Word to open
it? ...
www.topshareware.com/Large-Text-Fles
I'm having to deal with some third party that I am bulk inserting ...
discuss.fogcreek.com/joelonsoftware/default.asp?cmd=show&ixPost=34530 -
13k - Cached - Similar pages
Edit Large Text File
Large text file: downloadable software.
Large text file: Secure text chat, pdf to text batch converter, Secure
text chat.
www.vicman.net/lib/large/textfile - 49k - Cached - pages
Invision Power Services > Opening Large Text Files
What do you all use to open l examines a number of wayss to ...
www.4guysfromrolla.com/webtech/010401-1.shtml - 91k - Cached - Similar
pages
";

$articleBody=str_replace("\n"," ",$articleBody);
$articleBody=str_replace("\r"," ",$articleBody);
$articleBody=str_replace("\t"," ",$articleBody);
$articleBody=str_replace(" "," ",$articleBody);
$articleBody=str_replace(" "," ",$articleBody);

$bart=strlen($articleBody);

print "This string is $bart characters long . <br><br>";

$lisa=$bart/3;

$lisa=number_format($lisa,0,'.','');

$lisa=$lisa+10;

print "If 3 columns are used then its $lisa characters a column . <br>
<br>";

$smithers=trim($articleBody);

$newtext=wordwrap($smithers,$lisa,"\n");

$filename="zzzzz.php"; $fp=fopen($filename,"w"); fwrite ($fp,$newtext);
fwrite ($fp,"\n"); fclose($fp);

$filename="zzzzz.php"; $fp=fopen($filename,"r");
$qaz=fgets($fp); $homer[1]=trim($qaz);
$qaz=fgets($fp); $homer[2]=trim($qaz);
$qaz=fgets($fp); $homer[3]=trim($qaz);
fclose($fp);

?>

<br><br>

<table width="90%" border="0" cellspacing="0" cellpadding="0"
align="center">
<tr valign="top">
<td width="30%"><?php print $homer[1]; ?></td>
<td>&nbsp;&nbsp;</td>
<td width="30%"><?php print $homer[2]; ?></td>
<td>&nbsp;&nbsp;</td>
<td width="30%"><?php print $homer[3]; ?></td>
</tr>
</table>

<br><br>

</body>
</html>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация