You are here: Re: left « PHP « IT news, forums, messages
Re: left

Posted by Steve on 04/06/05 23:14

On Wed, 06 Apr 2005 21:58:40 +0200, Marco J.L wrote:

> Hello,
>
> how can I change the lenght of an value in basuc it's called LEFT or RIGHT
> and MID . I read the filenames but I want to strip the extension from the
> filename.
>
> ======== SCRIPT ==============
> <table style="font-family: tahoma,helvetica,arial; font-size: 12px;
> font-weight: bold; color: #000000">
> <?php
> $handle=opendir('news');
> while (false!==($file = readdir($handle))) {
> if ($file != "." && $file != "..") {
> echo "\n<TR><TD>$file\n";
> }
> }
> closedir($handle);
> ?>
>
> </body>
> </html>
> =======RESULT ========
> 200503290000.txt
> 200503300000.txt
> 200503310000.txt
> 200504010000.txt
>
> =======But I want this result : ======
> 200503290000
> 200503300000
> 200503310000
> 200504010000
>
> ===================
> Thanx,
>
> Marco J.L.

substr ( $name, 0, strlen ( $name ) - strlen ( '.txt' ) ); or
substr ( $name, 0, strrpos ( $name, '.' ) );

I'm probably the odd character out, but you get the idea...


Steve

 

Navigation:

[Reply to this 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

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