diff options
author | Wesley Dillingham <WWdillingham@sugarlabs.org> | 2009-08-04 19:08:49 (GMT) |
---|---|---|
committer | Wesley Dillingham <WWdillingham@sugarlabs.org> | 2009-08-04 19:08:49 (GMT) |
commit | a504e50a1ce559742d92defb5b4e6cd0aa35dc8c (patch) | |
tree | 7aca475a8e0e8364c249029bbc21bd81bf156538 | |
parent | 37acbfceae443b187e30f2ec5a26a1265178561f (diff) |
Initialize class aray
-rw-r--r-- | 4.N.10_Parser.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/4.N.10_Parser.php b/4.N.10_Parser.php index a8d34f9..88f8253 100644 --- a/4.N.10_Parser.php +++ b/4.N.10_Parser.php @@ -13,5 +13,41 @@ Select and use appropriate operations (addition, subtraction, multiplication, an $fp = fopen("./4.N.10.dat", "r"); if(!$fp) die ("Cannot open the file"); +//Break Each line of the file into its own array element - will have to parse each array element to obtain fields +$lines = file($fp); + + +$numWords = str_word_count($str); +//Will always be a multiple of four so $NumRecords will be $numWords/4 +$numRecords = $numWords / 4; +//Our Associative array Will also be in sequence 1,5,9,13.. + 4 etc +//Need to tokenize each line and choose appropriate elements ($1) +//This is just to fill the array with Variables. Next we will go through the same process for the remaining fields +// Perform the logic on them add them to additional associate arrays with various meanings +// For Example + +for (i=0;i<=$numRecords;i++) +{ + + + $tok = strtok($lines, " "); + + /* + Because in the end statement we will have to loop through one of the arrays, which will be localized according + #to specific aritmetic operations (- + / *). We need to account for the fact that some students may not answer a + #question with one of these operations, and if we looped through that particular operation, we would not represent + #that student in any of the logic containted within that loop in the END{} statment. Therefore an associative array + #which absolutely, accounts for any student, contained in the .dat, the CLASS[] array. + $Class[tok[0]]; + */ + + while ($tok !== false) + { + $Class[tok[0]]; + } + +} + + ?>
\ No newline at end of file |