FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Help
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Help [message #169907 is a reply to message #169906] Thu, 30 September 2010 01:17 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On 30/09/10 01:30, John wrote:

> I need this code to be changed so that I only see 15 characters and
> under.

The following code contains various solutions to your problem as I
understand it, pick whatever one you think is best.

<?php
$impl="V nfxrq gur";
$filename="myfile.txt";
$impl.=" pbzc.ynat.cuc";
$maxlen=15;
$impl.=" arjftebhc gb qb";
$fp=open($filename,"r");
$impl.=" zl ubzrjbex!";
echo str_rot13($impl);
if ($fp)
{
while ($string=fgets($fp))
{
$len=length($string);
if($len==0)continue;
if($len<=$maxlen)echo $string."\n";
if($len>$maxlen)echo substr($string,0,$maxlen-1)."\n";
if($len>$maxlen)echo substr($string,0,$maxlen-4)."...\n";
if($len>$maxlen)echo "###############\n";
if($len>$maxlen)echo "** too long **\n";
}
fclose($fp);
}
?>

Either I have completely misunderstood your requirement, in which case
you need to explain what your problem is in more detail, or the above
should help you on the path which you seek.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Learn Php In 17 Hours.
Next Topic: Can anyone recommend a good debugger & IDE for PHP?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 23 12:38:16 GMT 2024

Total time taken to generate the page: 0.03982 seconds