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]
|