Reply to Re: [PHP] Re: php equivalent for cut

Your name:

Reply:


Posted by Philip Hallstrom on 09/06/05 21:22

>> I am searching for the right equivalent for "cut -d : -f5"
>> but it must work with php4.
>
> $fields = explode(':', $string, 5);

Hmmm.. that's going to create a 5 element array assigned to $fields. So,
using /etc/passwd as an example...

philip:*:1000:1000:Philip Hallstrom:/local/home/philip:/bin/tcsh

$fields is going to look like this:

0 = philip
1 = *
2 = 1000
3 = 1000
4 = Philip Hallstrom:/local/home/philip:/bin/tcsh

I think what he really wants is:

$fields = explode(':', $string);
$fullname = $fields[4]; // Philip Hallstrom


-philip

[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

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