mattjtayl Posted October 25, 2007 Share Posted October 25, 2007 Ok I have to print an ACH file from an array I will recieve. I recieve this array through a function then I have to print this array to a file called "ACH.txt". The ACH file is broken down like this. position 01-017 is 1st record to be printed position 018-30 is 2nd record to be printed position 31-44 is 3rd record to be printed etc. I was thinking psuedo code like this get_ACH_array = function () { $ACH_Record = recieved array $ACH_Record = array(); $a = position 17 $b = positon 30 $c = position 44 or I would define variables like this $a = 17 $b = $a+13 $c= $b +14 create "ACH.txt" $file = "ACH.txt" $handle = fopen("ACH.txt", "w"); for ($i = 0; $i <$a, $i++){ fwrite $ACH_Record(i) } for ($i = 0; $i <$b, $i++){ fwrite $ACH_Record(i) } for ($i = 0; $i <$c, $i++){ fwrite $ACH_Record(i) } fclose($handle); } is this all right? is there a more effective way to do this? I know using actual numbers for indexing isn't a good thing Quote Link to comment https://forums.phpfreaks.com/topic/74718-printing-an-array-using-an-index/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.