Jump to content

Count Suggestions


Schlo_50

Recommended Posts

Hi there,

 

I am working on a script of mine, and one of the requirements is that I need to find the last row of a list I have stored as a .DAT and count the number of values in the row.

 

I can find the last row but am wondering if someone could point out how i'd count the values. For instance my .DAT may look like the following: (I need to find out how many values are in the bottom row.)

 

ID|Email|Name|Description      (4 values are in this row)

ID|Email|Description              (3 values are in this row, which is the one I need the sum of)

 

Can someone help please?

The code I have so far finds the last row.

 

$lines = file("./admin/data/candidates.DAT");
$last = $lines[count($lines)-1];
unset($lines);

$vals = explode("|", $last);

 

Thanks in advance

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.